extend Parcelable?

by Craig » Wed, 29 Oct 2008 23:14:33 GMT

Sponsored Links
 I have a class that extends a class that implements Parcelable. I have
instances of both classes in my app, and I would like to have the
subclass rely on the superclass' parceling methods for reading and
writing the superclass' variables, with the subclass only handling its
own extension.

It looks like there used to be a readFromParcel method on Parcelable
which would have suited my purpose, but with a static
Parcelable.Creator I'm not sure how to do it?

Anyone figure this out already?


extend Parcelable?

by Craig » Fri, 31 Oct 2008 00:24:05 GMT

 To answer my own question, I have what looks like a workable solution,
but I don't love it. Please add your improvements and offer better
suggestions, but I'd like to keep this conversation going.

I added a private no arg ctor to the superclass. The createFromParcel
method calls this, and then calls a static method on the superclass
that takes parameters of that class and a parcel. Subclass
Parcelable.CREATORs can do the same thing - create their own instance
and then call the superclass.setValues and pass the instance it is
creating. There isn't an issue writing the parcel - you can just call

This doesn't seem very elegant, and it may be slightly slower.

I may have 1 big class instead of splitting it up...

Sponsored Links

Other Threads

1. [WTShare] Superbox

Iseng2 liat market nemu aplikasi Superbox. Appsnya free tp menurut saya
sangat berguna. Cekidot!


2. Configuration setting for peak performance of HTTP download


We are using Android Gingerbread 2.3.3 on dual-core ARM based chip.

When we perform HTTP download of single 10MB text file, we get network
download speed of 8Mbps.

But, when we perform simultaneos HTTP download of more than one file
(for example, two different 10MB text files), we get total download
speed of 12Mbps.

Is there some configuration setting required in TCP stack, to achieve
peak throughput speed with single file itself ?

Vrukesh V. Panse


3. [Help] Ngga bisa download market

4. Maps - position of zoom controls

5. Using Droid-fu

6. booting from Nand flash

7. problem booting from nand flash