I am new to android development and I am making a simple android app which uses sqlite to persist some data.
I have a SqliteOpenHelper which handles the database side of things. I have an onCreate method which initiates the database
Class constructor
public CardDBHandler(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
super(context, CARD_DATABASE_NAME, factory, CARD_DATABASE_VERSION);
}
Where I instantiate it in another class
cardDBHandler = new CardDBHandler(this, null, null, 1);
The onCreate method
@Override
public void onCreate(SQLiteDatabase db) {
String query = "CREATE TABLE " + TABLE_CARDS + "(" +
CARD_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
DECK_ID + " INTEGER, FOREIGN KEY (" + DECK_ID +")
REFERENCES DATABASE_NAME(COLUMN_ID), " +
CARD_FRONT + " TEXT, " +
CARD_BACK + " TEXT " +
");";
db.execSQL(query);
Log.d(TAG, "Created card database");
}
I have since modified this method but my app is not registering the changes, which leads to some exceptions.
Am I supposed to add this class to the manifest the same way I add an activity? Thanks in advance.