How can I put an array of arrayList into a Bundle?
ArrayList < myObjects >[] mElements;
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.
Make
YourObjectimplement theParcelableinterface, then usebundle.putParcelableArraylist(theParcelableArraylist).Edit: whoops misread the question. Why do you want to save an array of arraylist? If its for persisting in an orientation change, maybe you want to use
onRetainNonConfigurationInstanceinstead?Edit 2: Ok, here goes. Create a new
Wrapperclass that implementsParcelable(note thatmyObjectsalso have to be parcelable). ThewriteToParcelmethod will look something like this:And the constructor: