android - Passing your own objects between activities -


I am a newbie on Android development and how to transmit data from one activity to another is still unclear for me. Is it a good practice to pass your own items between activities?

What size can they be?

EDIT: Maybe I did not clear it clearly I know how to pass data between activities is the question: is it a good practice or I get data from better SQLlite database should do? In that case, which is the maximum size that I can pass to perform well?

Sending the object Similar to sending pre-defined objects such as strings or variables, () Or maintenanceable () methods can be done directly by intent or by binding the object using the binding object to intent. But you have to make sure that your class either applies to a parcel or serial jub.

Like here:

  UserDefined myObject = new UserDefined (); Intent i = new intent (this, activity 2. class); Bundle B = new bundle (); B.putParcelable ("myObject", myObject); I.putExtras (b); StartActivity (i);   

To get more activity:

  bundle b = this.getIntent (). GetExtras (); MyObject = b.getParcelable ("myObject");   

You can also send items without using the bundle:

  intent = new intent (PicActivity.This, PostPhotoActivity.class); I.putExtra ("myObject", myObject); StartActivity (i);   

On receiving action:

  User defined myObj = (user defined) getIntent (). GetParcelableExtra ("myObject");   

Android is capable of making PayPal instead of serial

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -