Reputation: 31161
How do you pass an instance of ArrayList<ArrayList<HashMap<String, String>>>
from one Android activity to another via an instance of Bundle?
(I could use JSON strings. I'd like to know if there are better ways.)
Thanking you kindly in advance.
Upvotes: 2
Views: 1374
Reputation: 27455
In general it is not good to pass too many or too large data between activities via Intents. It's better to store them somewhere centrally and pass a lightweight identifier or something like this, so the other activity can retrieve them from the store.
E.g. you can use an Application class to store these data. An application class is always available as long as you application is running. You get it from each Activity by calling the getApplication() method.
Upvotes: 1
Reputation: 234847
You can pass it as an extra in the Intent that you use to fire up the new activity. Since ArrayList
implements Serializable
, you don't have to do anything special to feed it to Intent.putExtra()
.
Upvotes: 2