android - How to pass an Arraylist of Events through an Intent -
i'm trying pass list of events 1 activity 1 using intent, how tried it:
on activity 1:
arraylist<event> eventsselected= new arraylist(); eventsselected.add(new event(color.red, dateclicked.gettime(), "event1")); eventsselected.add(new event(color.red, dateclicked.gettime(), "event2")); eventsselected.add(new event(color.red, dateclicked.gettime(), "event3")); intent = new intent(firstactivity.this, secondactivity.class); i.putextra("eventsselected", eventsselected); startactivity(i);
but didn't find how on second activity, tried way didn't work :
on activity 2:
intent intent = getintent(); arraylist<event> selecteddates = intent.getstringarraylistextra("eventsselected");
you need implements serializable object class
public class event implements serializable { }
also
i.putextra("eventsselected",eventsselected);
Comments
Post a Comment