Wednesday, March 21, 2012

[android-developers] sending custom parcelable to another application

Hi,

I'm trying to send a custom Parcelable to another application (in another process). 

I have a client and a remote service, as well as an abstract class (say, AbstractCustomParcelable) that I added to the Android framework itself (for research purposes). The remote service should receive an object from the client that is an instantiation of this abstract class, and then call a method on it.

The problem is that if I extend AbstractCustomParcelable in the client (say, MyCustomParcelable) and then pass it to the service (by putting it in a Bundle with some other stuff and sending it via a Message), I get a ClassNotFoundError in the service:

android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.my.package.Client$MyCustomParcelable

I've done some searches and it appears I need to do something with the classloader, but I'm not sure where to set which classloader, and nothing I've tried has worked so far (e.g., doing setClassLoader(MyCustomParcelable.class.getClassLoader()) on the Bundle). Is there a way to make this work?


Thanks in advance!

Franzi

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate