Hi Anil,

This is not correct.  Here are a few examples:  If your app has two
services, there will be two different contexts running at the same time.  If
your app has two activities, one will still have methods running after
onPause.  Messages sent may be handled while another activity is still
running, depending on timing.  It would not be correct for one activity to
use another's Context.

-joe

On Wed, Apr 2, 2008 at 8:47 PM, Anil <[EMAIL PROTECTED]> wrote:

>
> Again, please correct me:
> But unlike J2SE, here in Android, zero or one contexts are 'active' or
> relevant in a thread.
> The thread started life and meandered along touching different
> contexts along the way.
> In other words, it is possible to state which was the last context
> touched, and will be relevant
> to the getContext() call. Will a thread of execution ever need
> anything other than the last context touched?
> thanks,
> Anil
>
>
>
> On Mar 31, 11:25 am, hackbod <[EMAIL PROTECTED]> wrote:
> > That is not true, all of the activities (and intent receivers and
> > services) are called in the main thread of the process they are
> > running in.  Also, calls to service interfaces and content providers
> > are executed in the calling thread, not their own thread.
> >
> > On Mar 31, 8:51 am, Anil <[EMAIL PROTECTED]> wrote:
> >
> > > NOTE: I could be mistaken in my facts below. Please correct me if I am
> > > wrong.
> >
> > > As per my understanding, a running thread exists in only one Activity
> > > at a
> > > time. In other words, it is not shared by activities. Hence only one
> > > context applies, even if the method is in some other class. However it
> > > is
> > > convoluted to access the context - it has to be passed into each
> > > constructor of each class. There have been several gripes about this
> > > in the
> > > newsgroup.
> > > Suggestion: have a getContext() call, that at runtime senses which is
> > > the
> > > applicable context for that thread, and returns it to that thread.
> > > And more than one thread being spawned off should still map to one
> > > activity context.
> > > So depending on the thread (Activity) in which the method executes, a
> > > different context could be returned.
> > > thanks,
> > > Anil
> >
>

--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to