I have a parcelable class whose writeToParcel() method puts some data
in a Bundle and writes it to the parcel.
This parcel gets sent from a client process to a service process.

At the side of the service, the readFromparcel() method tries to read
this Bundle from the parcel. A strange thing happens here.

First of all, I got a ClassNotFoundException for one of the objects
inside the Bundle. I "fixed" this by using readBundle(this.getClass
().getClassloader()) to force it to use the application's
classloader.

After this, I no longer got the ClassNotFoundException, but I did get
a different bundle, containing only the following entry:
mParcelledData.dataSize=376

This is not what's supposed to be in the bundle.

In the sourcecode Parcel.java I see this, in the readBundle
(Classloader) method:

final Bundle bundle = new Bundle(this, length);
if (loader != null) {
  bundle.setClassLoader(loader);
}


So the classloader is set after reading the bundle, instead of before.
Shouldn't that be the other way around?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to