Android - Store data in Array of Objects and display later in ListView -
i have 2 activities in tab-bar application. 1 activity (activity1) normal activity , other (activity2) listactivity. in activity1, there button stores every time tap on button data (date, value1,value2..) in array of objects. read possible intents. dont want start activity2 everytime tap on button.
how can pass array activity2, can display them later after tapped more once on button in listview?
edit :
here code. nullpointerexception, doesn't store correctly. object hat serializable implemented.
activity1:
intent datenintent = new intent(this, loggeractivity.class); bundle bundle = new bundle(); bundle.putserializable("daten",adatensatz); datenintent.putextras(bundle);
activity2:
bundle bundledata = this.getintent().getextras(); datensatz[] adatensatz = (datensatz[]) bundledata.getserializable("daten");
you can pass array in 1 shot 1 activity in following way :
bundle mybundle = new bundle(); b.putstringarray(key, array); intent = new intent(context, class); i.putextras(mybundle);
and receiveing
you can retrieve value in activity in following way:
bundle b = this.getintent().getextras(); string[] array = b.getstringarray(key);
hope helps.
Comments
Post a Comment