I want to clear my SQLite db every time I hit a particular spot in my application.
I intended on just making a method that I could call called resetTables()
, but this seems to be more challenging than I expected because I don't really know where to place it. Here is a snippet.
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(DATABASE_CREATE);
}
public void reset(SQLiteDatabase db) {
db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE);
}
I'm getting a yellow line under reset and I can't call this method in my code. Any ideas?
Note this question is similar, but couldn't get it to help me.
This worked:
public void resetTables(){
mDb.delete(TABLE_NAME, null, null);
}