yes ,I run Activity in the front but I hava run service run in the
background.Now I want use Toast.makeText this method show message on the
Activity. In Service I don't know get Activity context so Toast.makeText
method don't show message to screen.
2010/8/11 Bob Kerns
> My guess? I'd guess that
On Wed, Aug 11, 2010 at 6:26 AM, Bob Kerns wrote:
> But you want the service context, which is just 'this' (i.e. the
> service itself). The application context would work too, but generally
> you should go with the most specific context available unless you have
> a reason otherwise. Using some c
My guess? I'd guess that you're expecting it to immediately show up,
and you're continuing to do something right afterwards.
It will not show up until after you exit from the method.
Toast.show() queues up a request to show it, it doesn't actually do
anything on the screen itself. (It can't). It'
No, it's not either one, it's Application context.
But you want the service context, which is just 'this' (i.e. the
service itself). The application context would work too, but generally
you should go with the most specific context available unless you have
a reason otherwise. Using some context (
On Aug 11, 3:57 pm, CaryWang wrote:
> NO,getApplicationContext() is Service Context don't Activity Context.
Go to this page:
http://developer.android.com/reference/android/widget/Toast.html
Under the description of the method makeText, you will find:
Parameters
context The context to u
I use Toast.makeText(getApplicationContext(), "test",
Toast.LENGTH_SHORT).show(); don't display in the Activity.why?
2010/8/11 Sarwar Erfan
> Do you wan to display a Toast from a Service? You do not need any
> Activy to do so.
> A toast can be created and displayed from an Activity or Service. I
Do you wan to display a Toast from a Service? You do not need any
Activy to do so.
A toast can be created and displayed from an Activity or Service. If
you create a toast notification from a Service, it appears in front of
the Activity currently in focus.
A Service is indirectly derived from Conte
7 matches
Mail list logo