android - Is it possible to send a custom object with an Intent as an Extra -
i'm asking question: instread of giving string, int , on, can push custom object during creation fo new intent?
newactivity.putextra("jsondataresult", business.getjson());
in fact have 1 object constructed json (from webrequest) , parse , put on object.
at point i'm passing string returned webrequest intent parsing takes long time tu done, super-cool ability pass custom object intent.
edit : i'm using monodroid / xamarin, so
android.os.iparcelable cannot implemented, java.io.iserializable cannot implemented.
you can either let custom classes implement parcelable
(google says faster, have more coding) or serializable
. add objects bundle (or "extra"):
bundle b = new bundle() b.putparcelable("myobject",myobject); b.putserializable("myobject",myobject);
for info parcelable
checkout this
and if you're interested in difference between parcelable
, serializable
in more detail check out this
i prefer usage of serializable
simple object-passing, since code ist not spoiled code.
edit: ok isn't question similar this then?
Comments
Post a Comment