Hello,

   I'm trying to retrieve a Serializable object (Bundle.getSerializable
(String key)) from a Bundle I've constructed using the Bundle
(ClassLoader loader) constructor. While doing this I get a
ClassNotFoundException.

    The comment of the Bundle constructor states: "Constructs a new,
empty Bundle that uses a specific ClassLoader for instantiating
Parcelable and Serializable objects". I've looked through the source
code of the Bundle class and I noticed that retrieving a Serializable
object executes the Bundle.unparcel() method which finally comes down
to the Parcel.readValue(ClassLoader loader). All good so far. But the
readValue method doesn't use the ClassLoader to read Serializable
objects:

   case VAL_SERIALIZABLE:
            return readSerializable();

as it does when reading Parcelable objects:

  case VAL_PARCELABLE:
            return readParcelable(loader);

This seems to be the cause of the error I get.

 Is the comment of the Bundle(ClassLoader loader) constructor correct
and the reading of the Serializable object is a bug? Or is the code in
the Parcel.readValue() method correct and the comment is wrong? The
comment of the Bundle.setClassLoader(ClassLoader loader) method is a
but more vague in relation to Serializable objects: "Changes the
ClassLoader this Bundle uses when instantiating objects", although it
basically sets the same ClassLoader that is set in the constructor.
So, are Serializable objects retrieved using the specified ClassLoader
or not?

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

Reply via email to