Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>When you are creating an object of intent, you can take advantage of following two methods for passing objects between two activities.</p> <p><a href="http://developer.android.com/reference/android/os/Bundle.html#putParcelable%28java.lang.String,%20android.os.Parcelable%29" rel="nofollow noreferrer">putParceble</a></p> <p><a href="http://developer.android.com/reference/android/os/Bundle.html#putSerializable%28java.lang.String,%20java.io.Serializable%29" rel="nofollow noreferrer">putSerializable</a></p> <p>What you can do with this, is have your class implement either <a href="http://developer.android.com/reference/android/os/Parcelable.html" rel="nofollow noreferrer">Parcelable</a> or <a href="http://developer.android.com/reference/java/io/Serializable.html" rel="nofollow noreferrer">Serializable</a>.</p> <p>Then you can pass around your custom classes across activities. I have found this very useful.</p> <p>Here is a small snippet of code I am using</p> <pre><code>Matrix matrix = new Matrix (); Intent i = new Intent(); Bundle b = new Bundle(); b.putParcelable("CUSTOM_LISTING", matrix ); i.putExtras(b); i.setClass(this, NextActivity.class); startActivity(i); </code></pre> <p>And in newly started activity code will be something like this...</p> <pre><code>Bundle b = this.getIntent().getExtras(); if(b!=null) mCurrentListing = b.getParcelable("CUSTOM_LISTING"); </code></pre> <p>** EDITED WITH LINKS::: **</p> <p><a href="http://groups.google.com/group/android-beginners/browse_thread/thread/676a603928950e24/a898ae5c217318e1" rel="nofollow noreferrer">LINK1</a> consist of sample code</p> <p><a href="https://stackoverflow.com/questions/2736389/how-to-pass-object-from-one-activity-to-another-in-android">LINK2</a></p> <p><a href="http://shri.blog.kraya.co.uk/2010/04/26/android-parcel-data-to-pass-between-activities-using-parcelable-classes/" rel="nofollow noreferrer">LINK3</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload