I am accepting context as a parameter in the constructor of the class... but that's what the error says..
On Jan 28, 8:58 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 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---