How to reset SqLite database in Android?

前端 未结 6 909
一个人的身影
一个人的身影 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:07

    Bit late but this can help other people

    public void clearDatabase(String TABLE_NAME) {  
       String clearDBQuery = "DELETE FROM "+TABLE_NAME;  
       db.execSQL(clearDBQuery);  
       }  
    

    This should remove all the rows from the table refer documentation of SQLite database here!

提交回复
热议问题