[android-developers] Re: extending parcelables

2009-07-17 Thread Bart van Wissen
On Jul 16, 6:52 pm, Dianne Hackborn wrote: > Just use ArrayList as your data type. > Putting List in my aidl file resulted in the following errors: "The method writeBinderList(List) in the type Parcel is not applicable for the arguments (List)" for this line in the automatically generated Proxy

[android-developers] Re: extending parcelables

2009-07-16 Thread Dianne Hackborn
Just use ArrayList as your data type. On Thu, Jul 16, 2009 at 5:31 AM, Bart van Wissen wrote: > > > 2. Use a generic Parcelable class type, in which case the marshalling > code > > will inspect the class type, included that in the marshalled data, and > use > > that to re-construct it on the othe

[android-developers] Re: extending parcelables

2009-07-16 Thread Bart van Wissen
> 2. Use a generic Parcelable class type, in which case the marshalling code > will inspect the class type, included that in the marshalled data, and use > that to re-construct it on the other side. > I don't understand this. My program deals with Condition objects, which can be put in a list to

[android-developers] Re: extending parcelables

2009-07-15 Thread Dianne Hackborn
We deliberately don't support this kind of thing to keep the IPC protocol simple. You have basically two choices: 1. Use a concrete class type, which will result in ONLY that classes CREATOR being used to unmarshall its data. The protocol does no type inspection here, since that would introduce

[android-developers] Re: extending parcelables

2009-07-15 Thread Bart van Wissen
On Jul 15, 5:21 pm, Streets Of Boston wrote: > It looks like your Animal class is abstract and should never be > constructed. Declare Animal 'abstract' and see if you get an > instantiation error. It should be abstract, but I cannot make it abstract because then I cannot add the CREATOR to it, w

[android-developers] Re: extending parcelables

2009-07-15 Thread Streets Of Boston
It looks like your Animal class is abstract and should never be constructed. Declare Animal 'abstract' and see if you get an instantiation error. Have your tried to put the 'public static final Parcelable.Creator CREATOR' and 'public static final Parcelable.Creator CREATOR' variables and definiti

[android-developers] Re: extending parcelables

2009-07-15 Thread Bart van Wissen
I just noticed that my workaround is not actually working. I did the following inside my Animal's CREATOR.createFromParcel: className = source.readString(); a = (Animal) Class.forName(className).newInstance(); a.readFromParcel(source); Now a has the right type (so Cat or Dog), but somehow still