I have a very large data set for my base adapter in my Twitter-like app, which consists of custom models (with nested references) which are quite large in themselves.
The issue i'm having is, when re-creating the Activity on orientation change, the list is quite slow to populate (i'm currently passing the data set through onSaveInstanceState
)
I've looked into changing the way I serialise the models (currently using Kryo which has sped up the saving to disk aspect), caching to disk and reloading in onCreate
, using setRetainInstance(true)
in the list fragment, i've also tried handling configuration changes in the parent Activity.
Although the latter is the quickest, it's also the last option I want to take as there's a lot of downsides to handling orientation and would also mean having to re-write chunks of code.
My question is, what is the best practice of handing adapter repopulating on orientation?
I can foresee OOM errors when serialising the list to pass through onSaveInstanceState
Edit: Possible duplicate Best way to persist data between orientation changes in Android