I have a class that implements Parcelable interface:
class A implements Parcelable {
}
I have another class B th
The line:
obj = (A)in.readParcelable(A.class.getClassLoader());
should change to:
obj = (A)in.readParcelable(B.class.getClassLoader());
I encountered the same problem and did several Google search, many webpage or tutorial suggests we use A.class.getClassLoader() because we are casting to A, but actually it is WRONG because you will get a null value, we must use B.class.getClassLoader() because the codes are INSIDE class B. I just did not know why but it can get the correct A object in this way.
Welcome to comment and verify!!