java - pass Arraylist through intent -
i want pass taskitems
arraylist<hashmap<string,string>> taskitems = new arraylist<hashmap<string, string>>();
through intent second activity
arraylist<string> stringarr = new arraylist<string>(); stringarr.add(key_title); stringarr.add(key_info); stringarr.add(key_object); stringarr.add(key_location); arraylist<integer> intarr = new arraylist<integer>(); intarr.add(r.id.title); intarr.add(r.id.info); intarr.add(r.id.object); intarr.add(r.id.location); //neue oberfläche starten intent in = new intent(listviewactivity.this, listmenuitemactivity.class); in.putstringarraylistextra("stringadapter",stringarr); in.putintegerarraylistextra("intadapter",intarr); ------>in.putstringarraylistextra("taskitems",taskitems); startactivity(in);
i've marked spot. how can pass arraylist
through intent activity?
hashmap
extends serializable
interface, can pass arraylist
of serializable
objects:
arraylist<hashmap<string, string>> taskitems = new arraylist<>(); in.putextra("taskitems", taskitems);
and fetch like:
arraylist<hashmap<string, string>> taskitems = (arraylist<hashmap<string, string>>) in .getserializableextra("taskitems");
Comments
Post a Comment