I'm starting an activity when a button is pressed, and normally (in other apps) haven't had an issue. But when I press the button in this app, I get an "unable to marshal value" error.
Exact(ish) error from LogCat:
03-22 02:49:02.883: WARN/System.err(252): java.lang.RuntimeException: Parcel: unable to marshal value {CLASSNAME}@44dcf1b8
I feel that this might be related to the extra that I'm passing to the intent. I'm passing an ArrayList as a serializable to this new intent. My concern is that the data structure that the ArrayList contains isn't being serialized (as it's a personal data structure).
Is the array list content data structure causing this? Something else that I'm missing?
Make sure your class implements Serializable too. Just because the ArrayList itself can be serialized, doesn't mean that serialization will work if your class is not serializable. This error is the exact one you will receive if you try to serialize an ArrayList of a class which does not implement Serializable.
Try passing a Parcelable instead of a Serializable object, that will solve the problem.
Make sure that the class you are using implements Serializable:
If you doing something like this:
Cars cars;
bundle.putSerializable("mySerializable", (java.io.Serializable) cars);
Make sure that the Cars class implement serializable:
public class Cars implements Serializable{
精彩评论