StackLayoutManager icon indicating copy to clipboard operation
StackLayoutManager copied to clipboard

java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.

Open raj123456789123456789 opened this issue 7 years ago • 4 comments

Hi your layout manager is very good however i'm getting this error in private int fill(RecyclerView.Recycler recycler, int dy, boolean apply) { int delta = direction.layoutDirection * dy; // multiply the parallex factor if (apply) delta = (int) (delta * parallex); if (direction == LEFT) return fillFromLeft(recycler, delta); if (direction == RIGHT)

        return fillFromRight(recycler, delta);
    if (direction == TOP)
        return fillFromTop(recycler, delta);
    else return dy;
}

raj123456789123456789 avatar Jun 18 '18 11:06 raj123456789123456789

i can't reproduce this error. how did you find this error? just run the apk and that happened? it is sad , i will try to help

HirayClay avatar Jun 19 '18 00:06 HirayClay

Actually the error doesn't occur at first run I'm using this inside a fragment and when I switch tab and come back again and click on any of its item I start a new activity and when I come back from that activity and then when I click on any of its items it is giving me this error. Do you have any suggestions on how I could eliminate this error..

On Tue 19 Jun, 2018 6:18 am HirayClay, [email protected] wrote:

i can't reproduce this error. how did you find this error? just run the apk and that happened? it is sad , i will try to help

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/HirayClay/StackLayoutManager/issues/6#issuecomment-398239458, or mute the thread https://github.com/notifications/unsubscribe-auth/AjorBCEmRlPLV9AiGFaxT_yF3VZw5qQIks5t-EpegaJpZM4Urjxd .

raj123456789123456789 avatar Jun 19 '18 03:06 raj123456789123456789

of course ,you can add a defensive if statement “if (view.getParent() == null) addView(view)” in fillFromLeft fillFromTop fillFromRight these three methods. ifstatement It is a 'shameless' workaround util i find why.Another truth—— I am a noob in android and this layout manager kind of sucks when you dig deep into RecyclerView:neckbeard:

HirayClay avatar Jun 19 '18 06:06 HirayClay

I think you are a great developer because your layout manger has helped me a lot

raj123456789123456789 avatar Jun 19 '18 10:06 raj123456789123456789