I have a problem with parsing a Parcelable across an Intent.
I create parcelable using
Intent data = new Intent();
data.putExtra(ShoppingListAdapter.parcelName, la);
setResult(Activity.RESULT_OK, data);
I receive it in the onActivityResult:
Parcelable myData = data.getParcelableExtra(ShoppingListAdapter.parcelName);
Then pass it to another Activity using:
Intent myIntent = new Intent(this,Class.class);
myIntent.putExtra("myData", myData);
startActivityForResult(myIntent, RESULT);
My Parcelable has another Parcelable inside which I write and read uisng:
list = in.readParcelable(null);
I have tried using different class loaders, from ClassLoader.getSystemLoader() to MyClass.class.getClassLoader() but still I get a Runtime Exception:
06-12 21:13:04.940: ERROR/AndroidRuntime(29962): Caused by: android.os.BadParcelableException: ClassNotFoundException when unmarshalling:
Is my Parcel corrupted somewhere before this or am I reading it wrong?
Alex
As was pointed out this was an incorrect approach to use. So although I haven't solved it, there is a better way of doing the same thing. So consider it instead
How to declare global variables in Android?
Although if anyone has any idea for the answer to the original question please post. Can happen somewhere else to someone else.
Alex