• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Exchanging Messages containing Bundles with self-developed Parcelables

nimbus83

Lurker
Dec 2, 2008
1
0
[FONT=Courier, Monospaced]Hello,

[/FONT][FONT=Courier, Monospaced]I try to exchange objects of type android.os.Message between services in different processes. I add a bundle to each message. This bundle contains MyMessage object, which implements the Parcelable interface. I do it like this: [/FONT]
[FONT=Courier, Monospaced]
[/FONT][FONT=Courier, Monospaced]Message message = new Message();
[/FONT]
[FONT=Courier, Monospaced]Bundle bundle = new Bundle();
MyMessage myMessage = new MyMessage("this is some info", 0);
bundle.putParcelable("message", myMessage);
[/FONT]
[FONT=Courier, Monospaced]message.setData(bundle);
[/FONT]
[FONT=Courier, Monospaced]The code gets compiled, but at runtime I get the following error in the AIDL service interface of the service which is invoked:
[/FONT]
[FONT=Courier, Monospaced]android.os.BadParcelableException: ClassNotFoundException when
unmarshalling: de.android.examples.handler.probe1.messages.MyMessage [/FONT]

[FONT=Courier, Monospaced]What is wrong? How can I cope with this problem?
Is it possible at all to exchange between services android.os.Message objects containing Bundles with self-implemented Parcelables? [/FONT]
[FONT=Courier, Monospaced]
[/FONT][FONT=Courier, Monospaced]Thank you in advance. [/FONT]

[FONT=Courier, Monospaced]Best wishes,
Vladimir[/FONT]
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones