it seem that android SDK autmattically clear static fileds as it needs memory , how can I avoid specefic static filed to be cleared by android device …
public static ArrayList<PackageInfo> applications = new ArrayList<PackageInfo>();
thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
AFAIK you cannot really avoid these situations. There are many alternate methods like
Subclass the ‘Application’ class and add your values there. But this can also get set to null when android needs more memory.
The better solution would be to to use the sqlite storage. You can be sure that your data will not be cleared.
I would go with the option 2.