アイテムをリサイクルしているときに、リサイクラービューで製品上でこの奇妙なクラッシュに直面しており、このクラッシュも再現できません。
Fatal Exception: Java.lang.IllegalStateException: Already in the pool!
at androidx.core.util.Pools$SimplePool.release(Pools.Java:117)
at androidx.recyclerview.widget.AdapterHelper.recycleUpdateOp(AdapterHelper.Java:743)
at androidx.recyclerview.widget.AdapterHelper.recycleUpdateOpsAndClearList(AdapterHelper.Java:750)
at androidx.recyclerview.widget.AdapterHelper.consumePostponedUpdates(AdapterHelper.Java:123)
at androidx.recyclerview.widget.AdapterHelper.consumeUpdatesInOnePass(AdapterHelper.Java:557)
at androidx.recyclerview.widget.RecyclerView.processAdapterUpdatesAndSetAnimationFlags(RecyclerView.Java:3585)
at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep1(RecyclerView.Java:3829)
at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.Java:3639)
at androidx.recyclerview.widget.RecyclerView.consumePendingUpdateOperations(RecyclerView.Java:1877)
at androidx.recyclerview.widget.RecyclerView$ViewFlinger.run(RecyclerView.Java:5044)
at Android.view.Choreographer$CallbackRecord.run(Choreographer.Java:1092)
at Android.view.Choreographer.doCallbacks(Choreographer.Java:893)
at Android.view.Choreographer.doFrame(Choreographer.Java:809)
at Android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.Java:1078)
at Android.os.Handler.handleCallback(Handler.Java:891)
at Android.os.Handler.dispatchMessage(Handler.Java:102)
at Android.os.Looper.loop(Looper.Java:207)
at Android.app.ActivityThread.main(ActivityThread.Java:7539)
at Java.lang.reflect.Method.invoke(Method.Java)
at com.Android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.Java:524)
at com.Android.internal.os.ZygoteInit.main(ZygoteInit.Java:958)
計算中にrecyclerViewを更新しています。あなたはこのようなことをするべきです:
if (recyclerView != null) {
recyclerView.post(new Runnable() {
@Override
public void run() {
notifyDataSetChange(); //whatever you use, insert, remove, itemChanged etc...
}
});
}