I am trying to make my first Android app. I noticed that the SQLiteOpenHelper.onCreate() method is not called to create tables if the database not exists. Howev
Call getWritableDatabase(); in the constructor
public DataBaseH(@Nullable Context context) {
super(context, dataBaseName, null, dataBaseVersion);
SQLiteDatabase db=this.getWritableDatabase();
}
@Override
public void onCreate(SQLiteDatabase db) {
String createTable="CREATE TABLE IF NOT EXISTS "+tableName+ " ( "+
id+ " INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,"+
name+ " TEXT,"+
familyName+ " TEXT,"+
age+ " INTEGER);";
db.execSQL(createTable);
Log.i(TAG,"db.exect");
}