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 parcelablecheckout 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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -