Another way to share data between activities in the same process
is to use the Application class:

http://developer.android.com/reference/android/app/Application.html

You have to specify the name of your Application class in the
manifest and the framework will create only an instance of this
class, which will live while the application process is running.

In any activity, you can get the reference for your application
instance using:

Application a = getApplication();


On Jul 22, 10:49 am, Per Sandström <[email protected]> wrote:
> So far I have been using SharedPreferences to share data between
> activities. But I would very much like to find a better way. I would
> simply like both Activity1 and Activity2 to share Object1. Activity1
> will create Object1 and then start Activity2. What is the smartest way
> to give Activity2 a pointer to Object1?
>
> To summarize: Activities don't have constructors! How do I send data
> to them from their parent activity???
>
> Regards,
> Per Sandström
--~--~---------~--~----~------------~-------~--~----~
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