hello Kostya,

yes I think I going to use a lazy initialization, and retrieve the
data from the database if it's null. It's a bit more work but it
should works :)

On Apr 12, 11:24 am, Kostya Vasilyev <kmans...@gmail.com> wrote:
> Static variables aren't set to null. The process gets killed and
> reinitialized again when/if the user comes back.
>
> If you use a static to only pass data between activities, then don't
> reference it past that. Have the receiving activity store the data somewhere
> more persistent: a database, a data file, shared prefs, or a save it
> onSaveInstanceState.
>
> If you want the static obejct to act as some sort of persistent data manager
> that your activities can rely on, have it save the data somewhere, and use
> lazy initialization to bring the data in from that persistent memory as
> needed.
>
> If the data size is small, you might indeed be better off passing it between
> activities as part of the intent, as extras (basic types of Parcelable).
>
> -- Kostya
>
> 2011/4/12 Christophe <christophe.lebesner...@gmail.com>
>
>
>
>
>
>
>
> > that's probably the case. They should mention in the documentation
> > that static variable can be set to null at anytime, since they
> > explicitely state that static variable can be use to pass data between
> > activities ... (http://developer.android.com/resources/faq/
> > framework.html#3)
>
> > What the best way to keep data then ? May be a singleton ? I'm afraid
> > the instance will be set to null too :(
>
> > On Apr 12, 10:04 am, appel <johan.appelg...@gmail.com> wrote:
> > > If you don't set them to null somewhere it is most likely because your
> > > application process has been killed and restarted.
>
> > --
> > 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

-- 
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