Android: How can I save application wide instance state? -


regarding application wide state, have read many discussions pojo singletons vs. subclassing application class.

regarding saving state, i've learned activity.onsaveinstancestate.

but since application doesn't have lifecycle methods, how can save state used several activities?

my first idea use oncreate() , onsaveinstancestate() in main activity, happens if user pauses app while being in activity? when app comes front, activity, not main activity recreated, right?

will have same onsaveinstancestate , oncreate in activites or there way?

how can save state used several activities?

update persistent store when data changes. there no "instance state" "used several activities", definition.

my first idea use oncreate() , onsaveinstancestate() in main activity, happens if user pauses app while being in activity?

eventually, process gets terminated. "instance state" (e.g., onsaveinstancestate()) may supplied again later, depending on circumstances. absolutely need hold onto needs put persistent store (database, sharedpreferences, file), @ time data changed, how software has been written past 60 years.


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -