Search code examples
javaandroidandroid-intentserializable

Passing Object through intent, object can't be serializable


I have looked throughout Google and Stack Overflow and found that this should work when trying to pass an object through an Intent.

enter image description here

However I still get this error: enter image description here

This doesn't make sense as multiple websites have said this should work. Also here is where I try to retrieve it:

enter image description here

Any help would be appreciated.


Solution

  • You can't cast your class to Serializable, you need to implement it in your class like this:

     class Horse implements Serializable{
        //Your code here
    }