I have a fragment which contains FrameLayout with RecyclerView. When I replace or do any transaction on the fragment while a header is stickied in the RecyclerView, getting this crash.
I found the root cause of the crash. I'm setting my adapter as null on onDetachedFromWindow method of RecyclerView to get onDetachedFromRecyclerView callback on my RecyclerView to cleanup some resources (More about this https://github.com/airbnb/epoxy/wiki/Avoiding-Memory-Leaks, I'm not using Epoxy btw).
This calls removeAndRecycleAllViews which in turn calls positioner.clearHeader() which calls detachHeader. Here the header view is removed from the FrameLayout and that's where the issue is. I saw that you already experienced similar issue and handled it through safeDetachHeader by posting the removing process to run on later. I tried the same in detachHeader and it works fine now.
I have a fragment which contains
FrameLayout
withRecyclerView
. When I replace or do any transaction on the fragment while a header is stickied in theRecyclerView
, getting this crash.I found the root cause of the crash. I'm setting my adapter as null on
onDetachedFromWindow
method ofRecyclerView
to getonDetachedFromRecyclerView
callback on myRecyclerView
to cleanup some resources (More about this https://github.com/airbnb/epoxy/wiki/Avoiding-Memory-Leaks, I'm not using Epoxy btw).This calls
removeAndRecycleAllViews
which in turn callspositioner.clearHeader()
which callsdetachHeader
. Here the header view is removed from theFrameLayout
and that's where the issue is. I saw that you already experienced similar issue and handled it throughsafeDetachHeader
by posting the removing process to run on later. I tried the same indetachHeader
and it works fine now.Not sure if the fix is correct, hence opening an issue instead of PR.