On Aug 11, 3:57 pm, CaryWang <wangjf...@gmail.com> 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 } <webnet.andr...@gmail.com> > > > > > > > > > > > On 11 August 2010 11:50, CaryWang <wangjf...@gmail.com> 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 android-developers@googlegroups.com > > To unsubscribe from this group, send email to > > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> > > 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en