android - What is the best way to handle a large list data set with orientation changing? -
i have large data set base adapter in twitter-like app, consists of custom models (with nested references) quite large in themselves.
the issue i'm having is, when re-creating activity on orientation change, list quite slow populate (i'm passing data set through onsaveinstancestate
)
i've looked changing way serialise models (currently using kryo has sped saving disk aspect), caching disk , reloading in oncreate
, using setretaininstance(true)
in list fragment, i've tried handling configuration changes in parent activity.
although latter quickest, it's last option want take there's lot of downsides handling orientation , mean having re-write chunks of code.
my question is, best practice of handing adapter repopulating on orientation?
i can foresee oom errors when serialising list pass through onsaveinstancestate
edit: possible duplicate best way persist data between orientation changes in android
one of options avoid recreating activity on orientation change: this, in app manifest set configchangesattribute this
<activity android:name=".mainactivity" android:label="@string/activity_title" android:configchanges="keyboardhidden|orientation|screensize">
Comments
Post a Comment