Getting Parcelable encountered ClassNotFoundException reading a Serializable Object exception

kanishkpanwarkanishkpanwar USMember
edited September 2015 in Xamarin.Android

Hello,

I am seeing java.lang.RuntimeException: Parcelable encountered ClassNotFoundException reading a Serializable object (name = com.mypackage.MyClass) when I try to access Intent object (intent.Extras.KeySet()) returned from another app (built using Android/Java) via
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) { base.OnActivityResult(requestCode, resultCode, data); intent.Extras.KeySet(); }

I do have a matching class in my Xamarin Android Project. It is empty as I expect deserialization to create a simple object.
`
using System;
using Java.Interop;

namespace com.mypackage
{
public class MyClass: Java.Lang.Object, Java.IO.ISerializable
{
[Export("readObject", Throws = new[] {
typeof (Java.IO.IOException),
typeof (Java.Lang.ClassNotFoundException)})]
private void ReadObjectDummy(Java.IO.ObjectInputStream source)
{
Console.WriteLine("in ReadObject");
}

    [Export("writeObject", Throws = new[] {
    typeof (Java.IO.IOException),
    typeof (Java.Lang.ClassNotFoundException)})]
    private void WriteObjectDummy(Java.IO.ObjectOutputStream destination)
    {
        Console.WriteLine("in WriteObject");
    }
}

}`

I am using reference from https://forums.xamarin.com/discussion/451/communicate-with-iserializable

Tagged:

Answers

Sign In or Register to comment.