Why not put it in SharedPreferences? True, you will have to do the
serialization "by hand", since Android's support for it is so limited
(java.io.Serializable for pure Java classes only), but unless you have
a complicated object, that should pose no problem (if you do have a
complex object, consider XML with JSON instead of binary
serialization).

When I say "serialization by hand", what I mean is that you must break
the object down into String, Int, Float and Boolean yourself, so that
you can use SharedPreferences.getBoolean() etc.

http://developer.android.com/guide/topics/data/data-storage.html#pref
has sample code for this, as well as a discussion of other options.
But this option is most likely good enough.

On Jul 4, 5:34 am, Thomas Frick <[email protected]> wrote:
> Dear All,
>
> I have two activities.
> Activity A creates an object and stores some data in this object.
> After that, activity B ist started. In activity B I have to use the
> object created in activity A.
>
> What is the best way to pass the object from activity A to B?
>
> I think it is not possible to store an object in the
> SharedPreferences, isn't it?
>
> Is it a good way to call the object in activity A directly from
> activity B?
>
> Thanks for your help.
> Thomas

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

Reply via email to