Exchanging Messages containing Bundles with self-developed Parcelables


Last Updated:

  1. nimbus83

    nimbus83 New Member This Topic's Starter

    Joined:
    Dec 2, 2008
    Messages:
    1
    Likes Received:
    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]
     

    Advertisement

Share This Page

Loading...