java - Why I am gatting getting Parcelable encountered IOException when try to pass an Interface object through intent -
i trying pass interface object through intent.
public interface ilockkeyconfig extends serializable{ public void onkeyconfigchage(); } // doing in activity intent intent = new intent(lockscreensettings.this,buttoncustomization.class); ilockkeyconfig ilockkeyconfig = new ilockkeyconfig() { @override public void onkeyconfigchage() { system.out.println("onkeyconfigchage called"); } }; object[] keconfig = {lockscreenkeylist.get(position),ilockkeyconfig}; intent.putextra("keyconfigobj", keconfig); startactivity(intent); //and in activity b doing... private void getintentdata() { object[] keyconfigobj = (object[]) getintent().getserializableextra("keyconfigobj"); keyconfig = (keyconfig) keyconfigobj[0]; ilockkeyconfig = (ilockkeyconfig) keyconfigobj[1]; }
but above code getting following error:
`06-27 15:18:04.648: e/androidruntime(5483): java.lang.runtimeexception: parcelable encountered ioexception writing serializable object
what going wrong here?
you either implement parcelable or put serialized objecs arraylist. arraylist implements serializable , accept long arraylist have serializable objects.
putextra(string name, serializable value)
or
public intent putextra (string name, parcelable[] value)
Comments
Post a Comment