Search code examples
javaandroidonsaveinstancestate

How to store nested Arraylists in a Bundle in Android


I have this object in my Android App source code:

ArrayList<ArrayList<MyObject>> rsp

and i want to store it in a Bundle and use it in OnSaveInstanceState() method in my activity. Then i want to retrieve it from the bundle, too.

Should i use json? Is there another way?


Solution

  • you can use Parcelable to store the data in Bundle during OnSaveInstanceState()

    use the below link for more details :

    How to save custom ArrayList on Android screen rotate?