Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parcelable encountered IOException writing serializable object getactivity()

Caused by: java.io.NotSerializableException: com.resources.student_list.DSLL$DNode

Your DSLL class appears to have a DNode static inner class, and DNode is not Serializable.


Your OneThread Class also should implement Serializable. All the sub classes and inner sub classes must implements Serializable.

this is worked for me...


If you can't make DNode serializable a good solution would be to add "transient" to the variable.

Example:

public static transient DNode dNode = null;

This will ignore the variable when using Intent.putExtra(...).


if you POJO contains any other model inside that should also implements Serializable


For me this was resolved by making the variable withing the class transient.

Code before:

public class UserLocation implements Serializable {
   public Location lastKnownLocation;
   public UserLocation() {}
}

code after

public class UserLocation implements Serializable {
    public transient Location lastKnownLocation;
    public UserLocation() {}
}   

The exception occurred due to the fact that any of the inner classes or other referenced classes didn't implement the serializable implementation. So make sure that all the referenced classes must implement the serializable implementation.