Skip to content Skip to sidebar Skip to footer

Pass Arraylist Of Objects In Another Activity

I am trying to send an array list of objects in another activity. I have checked many articles on this topic and i am using parcelable but i am stuck at point where i cannot send t

Solution 1:

If what you want is to pass ArrayList<Form>, then use getParcelableArrayListExtra for this. Generally, follow these steps :

  • Make your Form class properly implement Parcelable
  • In activity sending intent :

    // ArrayList<Form> myList - data to send; intent.putParcelableArrayListExtra("geopoints", myList);

  • In receiving activity :

    ArrayList<Form> myReceivedList = getIntent().getParcelableArrayListExtra("geopoints");

And don't forget null/sanity checks.

Hope that helps

Post a Comment for "Pass Arraylist Of Objects In Another Activity"