recyclerview-animators
recyclerview-animators copied to clipboard
Many "isRecyclable decremented below 0" error logs
04-19 18:39:25.047 967-967/us.mitene.development E/View: isRecyclable decremented below 0: unmatched pair of setIsRecyable() calls for ViewHolder{7325e91 position=213 id=199807, oldPos=-1, pLpos:-1}
Calls to setIsRecyable(false)
and setIsRecyable(true)
should always be paired according to document.
+1
I get a lot of these log messages too. The code seems to still work, and no crashes; but something probably isn't right if these are getting spammed.
They haven't always been in my app. They seemed to start happening sometime after I added some more efficient use of notifyItemX() methods; not sure if that has something to do with it or not.
Removing the recyclerview-animator library and usage from my project makes the messages go away. So I am fairly sure it is some interaction with this library that is causing it, just not sure what exactly.
Occurring on Android 6 and 4.4 at least; haven't tested other OS versions yet.
See http://stackoverflow.com/a/29102232/3142018 for a solution
@csbenz what's the solution there? Seems unrelated
+1
According to @csbenz, the solution is to set holder.setIsRecyclable();
to false inside onClick method. Remember to set setIsRecyclable();
to true again after the view isn't expanded any more so that android can recycle it.
Thank you!
Does anyone have any insight as to how to fix this for animateChangeImpl? I have a viewholder using FastAdapter and toggle its selection. I have nothing extra myself, but disabling isRecyclable, doing the toggle, then reenabling it doesn't remove the error.
Nevermind. I'll post here in case someone else needs it, but animateChange
is a replica of the one in DefaultItemAnimator
What was missing was
if (oldHolder == newHolder) {
// Don't know how to run change animations when the same view holder is re-used.
// run a move animation to handle position changes.
return animateMove(oldHolder, fromX, fromY, toX, toY);
}
at the very beginning
I use the FlipInTopXAnimator
with an OvershootInterpolator
on a screen that user's can filter. I am also using multiple viewTypes. Without the animateMove
fix from DefaultItemAnimator
, the screen regularly crashes.