即使卸载并重新安装应用程序,onCreate方法仍未被调用。
Database.java:
public class Database extends SQLiteOpenHelper {
public static SQLiteDatabase db;
public Database(Context context) {
super(context,"db", null, 1);
Log.i("DB", "dbManager");
}
@Override
public void onCreate(SQLiteDatabase db) {
Log.i("DB", "dbOnCreate");
String s = "CREATE TABLE test(id INTEGER);";
db.execSQL(s);
}
@Override
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
Log.i("DB", "dbOnUpgrade");
}
}
我称之为:
Database db = new Database(this);
输出:
07-17 12:42:03.053 16448-16448/com.package.app I/DB: dbManager
这个问题是什么,如何解决?