No, this is wrong.

- If you are putting normal objects (primitives, Parcelable, Serializable)
into the Bundle, they will be copied and re-instantiated as the Intent
travels into the system process and back to your app.

- If you put IBinder objects in, a reference to the object will be
transfered, and you will receive back either the original object (if in the
same process) or a proxy object (if in another process).

And please: DO NOT PUT IBINDER OBJECTS IN TO INTENTS.  In most places
hopefully the framework prevents this.  If you do, your app will break
occasionally, when its process gets killed and the activity using the object
is re-instantiated.

On Tue, Jan 13, 2009 at 4:17 PM, Geoff Stromberg
<geoff.stromb...@gmail.com>wrote:

> I believe that if you pass an object from one activity (as in
> android.app.Activity) to another activity using Intent extras, and both
> activities belong to the same process (which is the default if they belong
> to the same .apk), then those two activities would be sharing the same
> in-memory object. However, if you started an activity in another process
> (e.g. from a different .apk), then the intent along with all its extras
> would be serialized into the other processes memory space.
>
>
>
> On Tue, Jan 13, 2009 at 3:38 PM, Inderjeet Singh <inder...@gmail.com>wrote:
>
>>
>> The "Active Objects" heading under
>> http://code.google.com/android/reference/android/os/Parcel.html seem
>> to indicate that activities can share in-memory Java objects as well.
>> Is my understanding correct?
>>
>> Anyone has had any experience with this? Are there any restrictions we
>> should be aware of? Can any two activities share in-memory Java object
>> like this or do they have to be from the same publisher?
>>
>> Thanks
>> Inder
>>
>>
>>
>> On Tue, Jan 13, 2009 at 3:02 PM, Geoff Stromberg
>> <geoff.stromb...@gmail.com> wrote:
>> > For any Java type that implements interface Serializable, you can use
>> the
>> > Intent methods:
>> >
>> >     public Intent putExtra(String name, Serializable value)
>> >     public Serializable  getSerializableExtra(String name)
>> >
>> > There's also a bunch of more type-specific put/get methods on Intent.
>> >
>> >
>> > On Tue, Jan 13, 2009 at 2:19 PM, Dianne Hackborn <hack...@android.com>
>> > wrote:
>> >>
>> >> You can include everything defined in the Intent API.
>> >>
>> >> On Tue, Jan 13, 2009 at 1:58 PM, inder <inder...@gmail.com> wrote:
>> >>>
>> >>> Can an activity receive Java objects in an Intent? Or the Intents must
>> >>> deal with string or byte[] only?
>> >>>
>> >>> Thanks
>> >>> Inder
>> >>>
>> >>>
>> >>
>> >>
>> >>
>> >> --
>> >> Dianne Hackborn
>> >> Android framework engineer
>> >> hack...@android.com
>> >>
>> >> Note: please don't send private questions to me, as I don't have time
>> to
>> >> provide private support.  All such questions should be posted on public
>> >> forums, where I and others can see and answer them.
>> >>
>> >>
>> >>
>> >
>> >
>> > >
>> >
>>
>>
>>
>
> >
>


-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to