android - How to save full instances of Activities and hence prevent reloading for each start? -
my android app converts website mobile application. design follows:
navigation drawer containing different categories of posts per website.
each option different activity. designed baseactivity (with navigation drawer initialisations) other activities extend, each activity has navigation drawer. (i not use fragments)
each activity calls json parser load posts website , hence takes upto 5 seconds load.
the problem activities/screens once opened not stay in memory when called time.
for example: home screen --> category 1 screen --> home screen causes home screen load second time , hence takes additional 5 seconds.
how can keep full (or @ least partial) instance of @ least 3 activities in memory avoid nuisance?
i call super.oncreate(savedinstancestate) each activity restarts beginning.
for example: home screen --> category 1 screen --> home screen causes home screen load second time , hence takes additional 5 seconds.
add appropriate flags intent
, such flag_activity_clear__top
, when going "home screen" activity. among other things, bring existing "home screen" instance foreground, rather creating new one.
how can keep full (or @ least partial) instance of @ least 3 activities in memory avoid nuisance?
your problem not whether in memory. if user visited them before, in memory. however, without flags on intent
or attributes in manifest control matters, each startactivity()
call creates new instance of activity.
so, first, need decide navigational flow of app be, particularly in terms of button, decide existing activity instances can reused.
second, need more effective caching strategy, rather storing stuff in individual activities. way, if wind creating new activity instances (to keep button flow way want), activities can retrieve data cache, rather have reload data web site.
Comments
Post a Comment