I'm working on an activity with a viewpager with 3 fragments.
After starting a pick image intent onactivityResult is called but
the starter activity is destroyed & created again.
(I've turned on Don't keep any activities,Developer settings.)
Now the problem is after activity is created fragments are also created again (Observed via Log)
This appears in Log after activity recreated.
E/Parcel: Class not found when unmarshalling: androidx.fragment.app.FragmentManagerState
java.lang.ClassNotFoundException: androidx.fragment.app.FragmentManagerState
The onActivity result is programatically forwarded to fragment via Activity>getsViewpager>getsAdapter>getsFragment
methods.
but now getContext()
in fragment returns null.
(Which means new fragments are created but onactivityResult
passes to old fragment?)
What i expect is either the old fragments should be reattached or the onActivityResult
passed to new fragments.
How can i distinguish new/old activity/fragments? How can i simply restore fragments after activity recreated? What is the problem causing Class not found when unmarshalling error.