1. Check out our companion app, Forums for Android! Download from Google Play

Exchanging Messages containing Bundles with self-developed Parcelables

Discussion in 'Application Development' started by nimbus83, Dec 2, 2008.

  1. nimbus83

    nimbus83 New Member
    Thread Starter

    Dec 2, 2008
    [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=Courier, Monospaced]Bundle bundle = new Bundle();
    MyMessage myMessage = new MyMessage("this is some info", 0);
    bundle.putParcelable("message", myMessage);
    [FONT=Courier, Monospaced]message.setData(bundle);
    [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=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,


Share This Page