Closed cabbage closed 9 years ago
As I learned right now, this does not only happen when I start a new Activity, but also when I lock the phone or generally leave the app and return to that screen. Another weird behaviour which is triggered by pausing/stopping the app is that when I swipe to delete the background drawable is visibly placed on the whole container instead of just the swipe-area (if that makes sense) Unfortunately I think I cannot provide screenshots due to our NDA.
But here are some implementation details:
The RecyclerView.Adapter
is created & injected by dagger in onActivityCreated()
and set to the RecyclerView
in onStart()
(after wrapping the adapter of course and initialising the swipe/drag'n'drop/touchguard managers). After that the Presenter loads the data into the Adapter
.
Hi. When do you call the RecyclerViewDragDropManager.release()
method? Initializing the RecyclerViewDragDropManager
multiple times without calling the release()
method may cause such problems.
Need to take care that View
instances (of course including the RecyclerView
) are kept alive even after the current Activity becomes background, so the same RecyclerView instance will be reused after returning the newly opened Activity.
Related post on StackOverflow:
Indeed I did release them in onDestroy()
- I changed that to onStop()
and it's working now.
Thanks a lot! That SO question was really enlightening :+1:
Hi,
I know that issue #10 is about the same error, but since it's closed and a bit older I'll start with a new one.
It's fairly easy to reproduce but not to understand (for me at least). When starting the
Activity
(it has aViewPager
and theRecyclerView
is in one of theFragment
s acting as pages) dragging the item views is not a problem. However, when I click an Item and start anotherActivity
and then return to theRecyclerView
and start dragging I get thisIllegalStateException
:Is there anything I might be missing?