On Aug 11, 3:57 pm, CaryWang <[email protected]> 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 use. Usually your Application or Activity object. Now, in Service, you have getApplication(), which you can cast to Context and use, if you do not want to use getAppllicationContext() Why dont you give a try to both of them? It will not harm your PC or device. What if it works? Regards Sarwar Erfan > > 2010/8/11 { Devdroid } <[email protected]> > > > > > > > > > > > On 11 August 2010 11:50, CaryWang <[email protected]> wrote: > > > I run service in the background I want to use Toast.makeText display > > message > > > to run Activity.but I don't know Activity context I know Activity > > > packageName and className.What should I do? > > > What about just using getApplicationContext()? > > > -- > > 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]<android-developers%[email protected]> > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > -- > Cary -- 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

