"*SharedPreferences are persistent, assuming that you use commit() or 
apply(). *"

Be mindful, though, when different parts of your app are running on 
different processes: If you change some SharedPreferences settings and call 
'commit()' in one process, these changes are not immediately available in 
the other process(es). This may require a restart of the process(es) before 
these changes become known to all the process(es).

On Friday, January 18, 2013 9:09:12 AM UTC-5, Mark Murphy (a Commons Guy) 
wrote:
>
> On Fri, Jan 18, 2013 at 8:58 AM, Jake Colman <col...@ppllc.com<javascript:>> 
> wrote: 
> > When an app get *re*created via a second kills to 
> > onCreate (following a kill) does it get the same context? 
>
> No. Objects cannot live beyond their process, and by definition, your 
> process was terminated. Hence, by definition, all objects in the new 
> process are different instances that any objects from the old process. 
>
> > If that is 
> > not guaranteed then should I not be using context-based preferences to 
> > persist my data? 
>
> I have no idea what you consider "context-based preferences" to be. If 
> you mean static data members, they should be used as a cache for 
> persistent data or for transient purposes only. 
>
> > Is there something other than 
> > PreferenceManager.getDefaultSharedPreference to do this? 
>
> SharedPreferences are persistent, assuming that you use commit() or 
> apply(). 
>
> -- 
> Mark Murphy (a Commons Guy) 
> http://commonsware.com | http://github.com/commonsguy 
> http://commonsware.com/blog | http://twitter.com/commonsguy 
>
> Aqui estão alguns sites onde você pode perguntar ou responder dúvidas 
> sobre desenvolvimento de aplicações para Android: 
> http://www.andglobe.com 
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to