Note that there are some explanatory texts on larger screens.

plurals
  1. POWithin an application what is the best way to pass custom objects between activities?
    primarykey
    data
    text
    <p>I know this question has been asked multiple number of times and i have been through a lot of these questions......almost all of these questions throw up the use of the parcelable interface for your class. However in a couple of questions i came across a quotation:</p> <p>"NOTE: Seeing Parcelable might have triggered the question, why is Android not using the built-in Java serialization mechanism? It turns out that the Android team came to the conclusion that the serialization in <strong>Java is far too slow to satisfy Android’s interprocess-communication requirements. So the team built the Parcelable solution.</strong> The Parcelable approach requires that you explicitly serialize the members of your class, but in the end, you get a much faster serialization of your objects. Also realize that Android provides two mechanisms that allow you to pass data to another process. The first is to pass a bundle to an activity using an intent, and the second is to pass a Parcelable to a service. <strong>These two mechanisms are not interchangeable and should not be confused. That is, the Parcelable is not meant to be passed to an activity.</strong> If you want to start an activity and pass it some data, use a bundle. Parcelable is meant to be used only as part of an AIDL definition."</p> <p>This quote can also be found in the book Pro Android 2.</p> <p>Now seeing that all activities within the same application run in the same process(<a href="https://stackoverflow.com/questions/6468126/every-activity-in-android-is-a-process-or-one-application-is-one-process">Every Activity in Android is a Process,or One Application is one process</a>),unless otherwise specified in the manifest,communication within the activities of the same application is not Interprocess communication per se.So is it really faster to use the parcelable class or is it just enough to pass your object attributes through bundle via intent ?</p> <p>Shedding any light on this aspect will be largely appreciated. Cheers !!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    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