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-threads.html
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 <[email protected]>wrote: > Yes. This data will stay in memory for as long as the process is alive. > > > 2011/6/20 Droid <[email protected]> > >> 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 [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> 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 [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Dianne Hackborn Android framework engineer [email protected] 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

