0

I have a class Tok that has some variables (int, int, String ... )

I also have a class TokList that extends ArrayList<Tok>.

In my MainActivity.java I created an TokList instance ( TokList tl = ... ), and filled it with some Toks. I want to pass this tl variable to another activity initiated from MainActivity.java

question is: What class must implement Parcelable (and have the required methods) and what will the intent.putExtra() argument look like in the MainActivity.java?

Mohammad Rahchamani
  • 5,002
  • 1
  • 26
  • 36

1 Answers1

0

your Tok class must implement Parcelable and when you're writing to parcel, for your TokList you should do this :

public void writeToParcel(Parcel out, int flags) {
    ...
    out.writeSerializable(yourList);
}
Mohammad Rahchamani
  • 5,002
  • 1
  • 26
  • 36