• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Sqlite Database context android

Bhavin392

Lurker
I have created a Database class file to use SQLite db in Android app. Since I am beginner and I am having problem understanding what should i put in context when I instantiate Database class to another class The database code is as follows:
public Database(@nullable Context context) {
super(context,DATABASE_NAME,null,DATABASE_VERSION);
database=getWritableDatabase();
How can I instantiate it to an another class. When doing instantiation Database db = new Database(); what should be put under context
 
I have created a Database class file to use SQLite db in Android app. Since I am beginner and I am having problem understanding what should i put in context when I instantiate Database class to another class The database code is as follows:
public Database(@nullable Context context) {
super(context,DATABASE_NAME,null,DATABASE_VERSION);
database=getWritableDatabase();
How can I instantiate it to an another class. When doing instantiation Database db = new Database(); what should be put under context
Database db =new Database(Combiner.this);. I tried this but its showing Database(android.content,Context) in Database cannot be applied to (com.example.data.Combiner)
 
Back
Top Bottom