db = openOrCreateDatabase("tompomodoros.db", Context.MODE_PRIVATE, null);
db.execSQL("CREATE TABLE mytable (_id INTEGER PRIMARY KEY AUTOINCREMENT, mydate VARCHAR, mydata SMALLINT)");
I use above code to create db and its table “mytable”. But for the second time I run it, the phone goes to dead. I guess that is because I create the table again but it already exists there.
So my question is how to create the table for the first time and open it for the rest times?
Try with
if not exists:and then us it as usual.