I have a ListFragment
which depends on the hosting Activity
to properly initialize. On first run, it loads up fine. Once I change the orientation, my app crashes. From the stack trace I can see it isn't me trying to add the Fragment
prematurely, rather Android is trying to restore the Fragment
.
I have setRetainInstance(false)
set in the onStart
method but can't find any method to disable the restoring of the Fragment
once the orientation changes. Any ideas? Do I need to remove the Fragment
prior to my app being destroyed?
Edit: I ended up delaying initializing the list until the Activity is ready. Android conveniently shows a 'loading' message until the adapter is set.
I ended up delaying initializing the list until the Activity is ready. Android conveniently shows a 'loading' message until the adapter is set.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With