I can I retain ArrayList<HashMap<String, String>> in bundle?
I want to display ListView immediately after rotating the screen.
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.
You dont have to save it in the
Bundle. In fact, that seems like a lot of info to store in aBundle.Since you are just saving a
HashMapofStringobjects, you could make a class to cache it for you or make it astaticfield in the class.Static fields are fine to use as long as they dont contain a reference to the
Activityor aVieworDrawable. (That can cause memory leaks)The simplest way you could do this might just be:
Because this field is
static, it will not be recreated when your activity is recreated. Rather, it will still be there for you to use with the same values.More ways to store data:
(These techniques apply to sharing data over a configuration change also).
http://developer.android.com/guide/faq/framework.html#3