Deekor Deekor - 5 months ago 89
Android Question

Parcel: unable to marshal value android.graphics.Path

I am trying to launch an new activity from my main activity. I have:

Button butt = new Button(this);
butt.setText("Colors");
butt.setBackgroundColor(paintCanvas.currentColor());
butt.setOnClickListener(new View.OnClickListener()
{
public void onClick(View view)
{
Intent intent = new Intent(PaintCanvas.this, PaletteActivity.class);
startActivity(intent);

}

});


This launches the new activity and then immediately throws the error:

10-18 01:41:01.090 28582-28582/com.deekor.fingerpainting E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Parcel: unable to marshal value android.graphics.Path@415c3c68
at android.os.Parcel.writeValue(Parcel.java:1235)
at android.os.Parcel.writeList(Parcel.java:622)
at android.os.Parcel.writeValue(Parcel.java:1195)
at android.os.Parcel.writeMapInternal(Parcel.java:591)
at android.os.Bundle.writeToParcel(Bundle.java:1619)
at android.os.Parcel.writeBundle(Parcel.java:605)
at android.os.Parcel.writeValue(Parcel.java:1170)
at android.os.Parcel.writeSparseArray(Parcel.java:662)
at android.os.Parcel.writeValue(Parcel.java:1198)
at android.os.Parcel.writeMapInternal(Parcel.java:591)
at android.os.Bundle.writeToParcel(Bundle.java:1619)
at android.os.Parcel.writeBundle(Parcel.java:605)
at android.os.Parcel.writeValue(Parcel.java:1170)
at android.os.Parcel.writeMapInternal(Parcel.java:591)
at android.os.Bundle.writeToParcel(Bundle.java:1619)
at android.os.Parcel.writeBundle(Parcel.java:605)
at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:2078)
at android.app.ActivityThread$StopInfo.run(ActivityThread.java:2874)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)


Whats going wrong? One my views uses paths, but why would that affect me stating a new activity?

Answer

a Path is not serializable. I had to create my own class that implements serializable.

Comments