As already mentioned earlier, you could also use Intents which are
very lightweight. You are able to attach also a data record to your
intent using the method putextra().

http://developer.android.com/reference/android/content/Intent.html


--
Roman Baumgaertner
Sr. SW Engineer-OSDC
·T· · ·Mobile· stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.


On Aug 4, 6:31 am, Per Sandström <[email protected]> wrote:
> but how do I create and pass this global object? I cant do it like I
> do in java or other programming languages where . AIDL is an
> alternative, but it still seems overkill for a small app.
>
> regards
> Per Sandström
>
> On Jul 22, 10:50 pm, niko20 <[email protected]> wrote:
>
> > On Jul 22, 1:19 pm, Roman <[email protected]> wrote:
>
> > > Android supports multiple IPC mechanisms.
>
> > > You can use the Intent mechanism as well as the AIDL mechanism for
> > > doing this. The AIDL approach is more complex but offers you also more
> > > flexibility to pass objects.
>
> > > Find information about this topic on
>
> > >http://developer.android.com/guide/developing/tools/aidl.html
>
> > > --
> > > Roman Baumgaertner
> > > Sr. SW Engineer-OSDC
> > > ·T· · ·Mobile· stick together
> > > The views, opinions and statements in this email are those of the
> > > author solely in their individual capacity, and do not necessarily
> > > represent those of T-Mobile USA, Inc.
>
> > > On Jul 22, 6:49 am, PerSandströ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,
> > > > PerSandström
>
> > Hi,
>
> > If both activities are in the same application, then just use a global
> > object and pass that around (singleton or such). Not too tough.
>
> > -niko
>
>
--~--~---------~--~----~------------~-------~--~----~
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