try passing getBaseContext() in place of this


On Wed, Jan 28, 2009 at 9:28 PM, Immy <[email protected]> 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 <[email protected]> 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 <[email protected]>
> wrote:
> >
> > >> Hi,
> >
> > >> Can anyone tell me how to access context of a class which is not an
> > >> activity?
> >
> > >> Thanks,
> > >> Immanuel
> >
>

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

Reply via email to