How to reset SqLite database in Android?

前端 未结 6 1037
一个人的身影
一个人的身影 2021-01-03 21:13

I want my users to be able to reset the application, then I need to reset the SQLite database that I have created. How can I do that? I want to reset the database or delete

6条回答
  •  感动是毒
    2021-01-03 22:16

    Working for me.

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        db.execSQL("DROP TABLE IF EXISTS TABLE_NAME");
        onCreate(db);
    }
    

提交回复
热议问题