0

I have a class containing 2 subclasses and have several instances of those subclasses.

ClassA{
private ClassB obj1;
private ClassB obj2;
private ClassC obj3;
private ClassC obj4;
private ClassC obj5;
private ClassC obj6;

private class ClassB{}
private class ClassC{}
}

Is it possible to make such a construct parcelable? How would I do that or what are the alternatives?

Thank you for any help you can offer!

Ma_Wo
  • 3
  • 2
  • just make them all serializable, parcelabl = serializable – Henning Luther Aug 10 '16 at 12:44
  • @HenningLuther Hi, the problem lay in my understanding of how the parcelable is build. Using the Parelable Plugin worked fine and did exactly what you suggested. Thank you! – Ma_Wo Aug 11 '16 at 05:53

1 Answers1

0

First add a Android Studio Plugin for creating parcelable class.

Goto

File -> Settings -> Plugins and search 'parcelable' and click on Browse and install Android Parcelable Code generator.

now open your class which you want to make parcelable and then goto

Code -> Generate (ALT+Insert)

and select Parcelable, select the field you want to be parcelable and thats it, it will generate the required code.

Do this for all the sub classes.

Nishant Pardamwar
  • 1,450
  • 12
  • 16
  • Omg. For whatever reasson I was under the impression that I could use only one of each class type to write to a parcel. Read: I can add one int or several ints via an array. Thank you very much for the help and especially for the plugin. That helps alot! – Ma_Wo Aug 11 '16 at 05:38