Reputation: 1559
I have a simplest object, and for this I use parcelable. But this object is more complex, have multidimensional array and I really don't know how to write the parcelable methods:
public class PointSystem
{
private int point;
private boolean [] vec1;
private HashSet <Integer> hs1;
private int [][] vecMap;
}
I removed the other istance variable of the same type and the methods so the code is more readable. I tried with serializable but I don't know how to cast from the other intent the serializable that I get to array [][].
How could I make this object parcelable? Or there're other way to pass this object to another intent?
Upvotes: 0
Views: 599
Reputation: 465
First off, you say you try to cast the serializable you get to array[][], are you trying to pass all of the members of this object as separate extras? Why not serialize the entire PointSystem object and pass it as an extra. Then, when you try to receive it:
PointSystem p = (PointSystem) getIntent().getSerializableExtra("Extra_Name");
int[][] vecMap = p.vecMap;
A good example of using Parcelable can be found within this answer
Upvotes: 1