Ok thanks for that. The static ArrayList var will certainly be good
enough for what my app requires. I was worried that it might
dissappear between activities by an agressive memory clear up. :)





On Jun 20, 9:52 pm, Dianne Hackborn <hack...@android.com> wrote:
> I wouldn't say yes.  "Calling it often" does not make sure it remains in
> memory.  You are only guaranteed it will remain in memory for as long as
> your app is in the foreground, that is as long as its process is required as
> per:http://developer.android.com/guide/topics/fundamentals/processes-and-...
>
> Once your app is no longer in the foreground -- because the user pressed
> home, went to a notification, received a call, etc -- then your process may
> be killed at any point and all bets are off.
>
> On Mon, Jun 20, 2011 at 12:24 PM, Kostya Vasilyev <kmans...@gmail.com>wrote:
>
>
>
>
>
> > Yes. This data will stay in memory for as long as the process is alive.
>
> > 2011/6/20 Droid <rod...@gmail.com>
>
> >> I am storing an ArrayList in a static variable in an ordinary (non
> >> activity) java class.
> >> It works correctly when I load it from an activity, but will it be
> >> guaranteed to remain
> >> in memory even when my activity is not calling it often?
>
> >> Here is the class:
>
> >> package com.maps.spoken;
>
> >> import java.util.ArrayList;
>
> >> public class NoWordRepeats {
>
> >>        public static ArrayList<String> ar = new ArrayList<String>();
>
> >> }
>
> >> --
> >> 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
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.

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