Thanks a lot guys...
That should solve my problem..

On Jan 29, 8:28 am, Dianne Hackborn <hack...@android.com> wrote:
> Don't use getBaseContext(), just use the Context you have.
>
> And if you are doing something from a background service, Service is-a
> Context, so you can just use the service instance.
>
>
>
> On Wed, Jan 28, 2009 at 7:26 PM, suhas gavas <suhas.ga...@gmail.com> wrote:
>
> > try passing getBaseContext() in place of this
>
> > On Wed, Jan 28, 2009 at 9:28 PM, Immy <immanueln2...@gmail.com> wrote:
>
> >> Hi,
>
> >> Thanks for the reply..
>
> >> This is what I'm doing in all other classes, which happen to be
> >> Activities...
> >> But here,
>
> >> Database_mob mDbHelper = new Database_mob(this);
>
> >> generates an error which says Database_mob(*classname*) is undefined.
>
> >> Regards,
> >> Immanuel
>
> >> On Jan 28, 12:51 pm, suhas gavas <suhas.ga...@gmail.com> wrote:
> >> > make object of the class in which u have to use the context .........
> >> Then
> >> > pass as parameter this to the class ............ And the class in which
> >> u
> >> > have to use conext should have constructor as parameter context in it
>
> >> > e.g
>
> >> > class activity extends Activity
> >> > {
> >> >      Viewclass myclass;
> >> >       public oncreate()
> >> >       {
> >> >          myclass = new Viewclass (this);
>
> >> >        }
>
> >> > }
>
> >> > -----------------------------------------------
>
> >> > class Viewclass
> >> > {
> >> >     public Viewclass (Context context)
> >> >    {
> >> >     }
>
> >> > }
>
> >> > > On Wed, Jan 28, 2009 at 12:43 PM, Immy <immanueln2...@gmail.com>
> >> wrote:
>
> >> > >> Hi,
>
> >> > >> Can anyone tell me how to access context of a class which is not an
> >> > >> activity?
>
> >> > >> Thanks,
> >> > >> Immanuel
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support.  All such questions should be posted on public
> forums, where I and others can see and answer them.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to