android - Nested Parcelling : RuntimeException - Unmarshalling unknown type code 3211319 at offset 440 -
i need send data activity
, may running in different context. created class a, has arraylist
of datatype b 1 of instance member . declared class b class a's inner class. send class a's instance through intent
, made class , b both parcelable
.
class structure (this not include complete code e.g. code written make classes parcelable
):
public class implements parcelable{ public class b implements parcelable{ public arraylist<string> value; .... .... public void writetoparcel(parcel dest, int flags) { dest.writelist(value); } .... .... } public list<b> group; public string name; .... .... public void writetoparcel(parcel dest, int flags) { dest.writelist(group); dest.writestring(name); } .... .... }
i used putextra (string name, parcelable value)
function put data.
but on receiving side, got following exception:
uncaught handler: thread main exiting due uncaught exception e/androidruntime( 1087): 1289817569622 java.lang.runtimeexception: error receiving broadcast intent { act=android.intent.action.set_voip_supp_service_request_local (has extras) } in com.hsc.example.android.myapp.myappactuvity$1@43b409b0 e/androidruntime( 1087): @ android.app.activitythread$packageinfo$receiverdispatcher$args.run(activitythread.java:765) e/androidruntime( 1087): @ android.os.handler.handlecallback(handler.java:587) e/androidruntime( 1087): @ android.os.handler.dispatchmessage(handler.java:92) e/androidruntime( 1087): @ android.os.looper.loop(looper.java:123) e/androidruntime( 1087): @ android.app.activitythread.main(activitythread.java:4363) e/androidruntime( 1087): @ java.lang.reflect.method.invokenative(native method) e/androidruntime( 1087): @ java.lang.reflect.method.invoke(method.java:521) e/androidruntime( 1087): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:860) e/androidruntime( 1087): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:618) e/androidruntime( 1087): @ dalvik.system.nativestart.main(native method) e/androidruntime( 1087): caused by: java.lang.runtimeexception: parcel android.os.parcel@43b51240: unmarshalling unknown type code 3211319 @ offset 440 e/androidruntime( 1087): @ android.os.parcel.readvalue(parcel.java:1777) e/androidruntime( 1087): @ android.os.parcel.readlistinternal(parcel.java:1956) e/androidruntime( 1087): @ android.os.parcel.readlist(parcel.java:1302) e/androidruntime( 1087): @ com.hsc.example.android.myapp.a.<init>(a.java:61) e/androidruntime( 1087): @ com.hsc.example.android.myapp.a.<init>(a.java:57) e/androidruntime( 1087): @ com.hsc.example.android.myapp.a$1.createfromparcel(a.java:67) e/androidruntime( 1087): @ com.hsc.example.android.myapp.a$1.createfromparcel(a.java:1) e/androidruntime( 1087): @ android.os.parcel.readparcelable(parcel.java:1845) e/androidruntime( 1087): @ android.os.parcel.readvalue(parcel.java:1713) e/androidruntime( 1087): @ android.os.parcel.readmapinternal(parcel.java:1947) e/androidruntime( 1087): @ android.os.bundle.unparcel(bundle.java:169) e/androidruntime( 1087): @ android.os.bundle.getparcelable(bundle.java:1037) e/androidruntime( 1087): @ android.content.intent.getparcelableextra(intent.java:3269) e/androidruntime( 1087): @ com.hsc.example.android.myapp.myappactuvity$1.onreceive(myappactuvity.java:219) e/androidruntime( 1087): @ android.app.activitythread$packageinfo$receiverdispatcher$args.run(activitythread.java:754) e/androidruntime( 1087): ... 9 more
then moved class b, outside class (as thought may problem of inner class, , declared creator static. static declaration not present when class b inner class of class a). did not helped.
this seems problem due nested parceling.
any suggestion ??
note: when used android.os.bundle.putparcelable(string key, parcelable value)
function of bundle class, , unmarshalled using android.os.bundle.getparcelable(string key)
fine. seems problem respect intents only.
did include creator in both?
public static final parcelable.creator<a> creator = new parcelable.creator<a>() { public createfromparcel(parcel in) { return new a(in); } public a[] newarray(int size) { return new a[size]; } };
& constructors take parcel:
public a(parcel parcel) { name = parcel.readstring(); //etc.. }
?
Comments
Post a Comment