I have an ArrayList of objects. ie ArrayList<ObjectName>
.
I want to pass this to a new Activity
. I tried to use putParcelableArrayList
but it has issues with the object. I removed the <ObjectName>
part from the creating of the variable and the method works but then I get eclipse complaining about unsafe stuff.
How do I pass this ArrayList<ObjectName>
to a new Activity
Thanks for your time
EDIT
I tried this :
ArrayList<ObjectName> arraylist = new Arraylist<ObjectName>();
Bundle bundle = new Bundle();
bundle.putParcelableArrayList("arraylist", arraylist);
I get the following Error:
The method `putParcelableArrayList(String, ArrayList<? extends Parcelable>)` in the type `Bundle` is not applicable for the arguments `(String, ArrayList<ObjectName>)`
EDIT2
Object Example Code. Do I need to changed this for Parcelable
to work?
public class ObjectName {
private int value1;
private int value2;
private int value3;
public ObjectName (int pValue1, int pValue2, int Value3) {
value1 = pValue1;
value2 = pValue2;
value3 = pValue3;
}
// Get Statements for each value below
public int getValue1() {
return value1;
}
// etc
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…