Passing arraylist of objects between activities

Intent intent=new Intent(ActivityFrom.this,ActivityTo.class);
intent.putExtra("StringKey",arrayList);
startActivity(intent);

and to retrieve

ArrayList<String> myList = (ArrayList<String>) getIntent().getSerializableExtra("StringKey");

You should make your Song class implement Parcelable.


You try the below

intent.putParcelableArrayListExtra("key", ArrayList<T extends Parcelable> list);
startActivity(intent);

Retrieve it

getIntent().getParcelableArrayListExtra("key");

Pass arraylist of user defined objects to Intent android. Check the answer by Sajmon

According to the comments made by Sajmon, Song class has to implement Parcelable


     i.setClass(LatestAlbums.this, AlbumDetails.class);
     i.putStringArrayListExtra("list", your song list);
     startActivity(i);

To get the array list in activity.

ArrayList<String> fetchList= new ArrayList<String>();
fetchList=  getIntent().getStringArrayListExtra("list");

Hope this will help you.

For more reference use this link.