The constructor DATABASE_mob(*CLASSNAME*) is undefined

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

The constructor DATABASE_mob(*CLASSNAME*) is undefined

Postby immanueln2005 » Wed Jan 28, 2009 8:03 am

Hi,

I'm trying to access to access a database from a class...

This is the code i use..

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. DATABASE_mob mDbHelper = new DATABASE_mob(this);
  2.  
  3.               mDbHelper.open();
  4.  
  5.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


I get an error while compiling which says,
The constructor DATABASE_mob(*CLASSNAME*) is undefined

Hope to find a solution to this.

Thanks,
Immanuel
immanueln2005
Developer
Developer
 
Posts: 42
Joined: Tue Dec 30, 2008 1:25 pm
Location: INDIA

Top

Postby MrSnowflake » Thu Jan 29, 2009 10:35 am

Pretty simple, you didn't implement your DATABASE_mob constructor correctly, so it doesn't support have a Context as argument... Post your code and we will help.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby immanueln2005 » Thu Jan 29, 2009 10:50 am

Sorry i dint update this thread..

I found a solution to this problem.. I was accepting a context as a parameter into the constructor of the class that managed the database.

I could not obtain a context of the class which gave the error.. So i got it from the calling activity and passed it to the constructor of the class that managed the database..

Hope i'm clear...
Thanks for the reply..
immanueln2005
Developer
Developer
 
Posts: 42
Joined: Tue Dec 30, 2008 1:25 pm
Location: INDIA

Postby MrSnowflake » Thu Jan 29, 2009 10:51 am

Yup it's clear and passing the Activity to it's children is almost always the way to do stuff like this.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby immanueln2005 » Thu Jan 29, 2009 11:03 am

:) Thanks for the reply
immanueln2005
Developer
Developer
 
Posts: 42
Joined: Tue Dec 30, 2008 1:25 pm
Location: INDIA

Postby MrSnowflake » Thu Jan 29, 2009 11:31 am

Yesterday I had my last exam, and my gf is at work, so I have loads of time now :).
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 4 guests