[android-developers] Re: Context of a class

2009-01-28 Thread Immy
Thanks a lot guys... That should solve my problem.. On Jan 29, 8:28 am, Dianne Hackborn 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 W

[android-developers] Re: Context of a class

2009-01-28 Thread Dianne Hackborn
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 wrote: > > try passing getBaseContext() in place of this > > > > > On

[android-developers] Re: Context of a class

2009-01-28 Thread suhas gavas
try passing getBaseContext() in place of this On Wed, Jan 28, 2009 at 9:28 PM, Immy 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 er

[android-developers] Re: Context of a class

2009-01-28 Thread Immy
Thanks for replying.. Exactly what I wanted.. Solves one scenario in my application.. Here is the other, I intend to use a Alarm in my application, which periodically connects to a web service to update my database. Here no activity is involved. I intend to make it a background service. But this

[android-developers] Re: Context of a class

2009-01-28 Thread Mark Murphy
Immy 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. That would be because cla

[android-developers] Re: Context of a class

2009-01-28 Thread Immy
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 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 =

[android-developers] Re: Context of a class

2009-01-28 Thread Immy
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 wro

[android-developers] Re: Context of a class

2009-01-27 Thread suhas gavas
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 on

[android-developers] Re: Context of a class

2009-01-27 Thread suhas gavas
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 on