[android-developers] Re: suggestion: the *relevant* context should be automatically accessible from any method

2008-04-03 Thread Anil

ok, thanks!

On Apr 2, 11:24 pm, "Joe Onorato" <[EMAIL PROTECTED]> wrote:
> 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 android-developers@googlegroups.com
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
-~--~~~~--~~--~--~---



[android-developers] Re: suggestion: the *relevant* context should be automatically accessible from any method

2008-04-02 Thread Joe Onorato
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 android-developers@googlegroups.com
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
-~--~~~~--~~--~--~---



[android-developers] Re: suggestion: the *relevant* context should be automatically accessible from any method

2008-04-02 Thread Anil

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 android-developers@googlegroups.com
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
-~--~~~~--~~--~--~---



[android-developers] Re: suggestion: the *relevant* context should be automatically accessible from any method

2008-04-01 Thread hackbod

On Apr 1, 3:35 pm, trickybit <[EMAIL PROTECTED]> wrote:
> Isn't it the case that these calls are run on threads belonging to the
> called process, but these are not the main thread, and they model a
> synchronous call on the calling thread?

True for most of the calls on ContentProvider (content providers are
just fundamentally multi-threaded); for Service this is only the case
for calls to any IBinder interfaces it publishes.

--~--~-~--~~~---~--~~
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
[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
-~--~~~~--~~--~--~---



[android-developers] Re: suggestion: the *relevant* context should be automatically accessible from any method

2008-04-01 Thread trickybit



On Mar 31, 9:25 am, hackbod <[EMAIL PROTECTED]> wrote:
>  Also, calls to service interfaces and content providers
> are executed in the calling thread, not their own thread.

Isn't it the case that these calls are run on threads belonging to the
called process, but these are not the main thread, and they model a
synchronous call on the calling thread?

Jim
--~--~-~--~~~---~--~~
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
[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
-~--~~~~--~~--~--~---



[android-developers] Re: suggestion: the *relevant* context should be automatically accessible from any method

2008-03-31 Thread hackbod

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 android-developers@googlegroups.com
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
-~--~~~~--~~--~--~---