-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crashing when i use recyclerview in fragments #42
Comments
Please your code. |
For me too when using in fragment. Code is standard recyclerview in fragment with adapter like here: 11-12 18:58:03.022 26703-26703/de.demoapp.app E/AndroidRuntime: FATAL EXCEPTION: main |
I also started seeing these occasionally with recyclerview-animators-2.2.3, com.android.support:recyclerview-v7:23.4.0 on Genymotion (Nexus 5 running Android 5.1). As it stands right now, I can't reproduce it :-( Will add more details in case I can. Preventively adding This is my stack trace: |
The fix which worked for me: do not reuse the same animator instance across multiple recycler view instances! I had a static field referring the animator instance. I was creating two instances of the fragment containing the recycler view, but I also noticed the issue when the single fragment instance got recycled and a another instance created. |
@renyedi Exactly the right answer! |
java.lang.IllegalArgumentException: Scrapped or attached views may not be recycled. isScrap:false isAttached:true
09-27 11:07:30.772 25402-25402/mobile.bikerenterzowner E/AndroidRuntime: at android.support.v7.widget.RecyclerView$Recycler.recycleViewHolderInternal(RecyclerView.java:4705)
09-27 11:07:30.772 25402-25402/mobile.bikerenterzowner E/AndroidRuntime: at android.support.v7.widget.RecyclerView.removeAnimatingView(RecyclerView.java:1050)
09-27 11:07:30.772 25402-25402/mobile.bikerenterzowner E/AndroidRuntime: at android.support.v7.widget.RecyclerView.access$5300(RecyclerView.java:141)
09-27 11:07:30.772 25402-25402/mobile.bikerenterzowner E/AndroidRuntime: at android.support.v7.widget.RecyclerView$ItemAnimatorRestoreListener.onAddFinished(RecyclerView.java:9622)
09-27 11:07:30.772 25402-25402/mobile.bikerenterzowner E/AndroidRuntime: at android.support.v7.widget.RecyclerView$ItemAnimator.dispatchAddFinished(RecyclerView.java:9967)
09-27 11:07:30.772 25402-25402/mobile.bikerenterzowner E/AndroidRuntime: at jp.wasabeef.recyclerview.animators.BaseItemAnimator$DefaultAddVpaListener.onAnimationEnd(BaseItemAnimator.java:645)
The text was updated successfully, but these errors were encountered: