Let's assume that I have this small class:
public Class A {
private int mA = 0;
private MyInterface mInterface = null;
public interface MyInterface {
public void test();
}
public void setA(int a) { mA = a; }
public void setInterface(MyInterface i) { mInterface = i; }
}
OK. Now, how I can make it Parcelable
?
Adding mA
to a Parcel
is easy, but how I can Parcel interface mInterface
? I have not found any examples for adding interface to a Parcel
.
Regards
UPDATE:
I should say that I have been able to do this as a Seializable
class. But I like to know how this can be done in Parcelable
.
Examples for Serializable
can be found here: Android: How to send interface from one activity to another
Just extend your interface by Parcelable interface. E.g :
public interface MyInterface extends Parcelable