I\'ve created a list and would like to pass the list to another activity but i\'m getting an error on the putExtra statement when i create the intent. Just wondering is ther
I know it is a little late and this question has an answer already but here is another way.
simply create another object define it as Serializable
and give it a list variable and send that using putExtra
on your intent
like this:
public class Category implements Serializable {
private List objects;
public Category() {
}
public List getObjects() {
return objects;
}
public void setObjects(List objects) {
this.objects = objects;
}
and then for sending it do this:
Category cat = new Category();
cat.setObjects(objects);
intent.putExtra("listOfObjects",cat);
startActivity(intent);
and to get the object you have created do this:
Category cat = (Category) extras.get("listOfObjects");
cat.getObjects;