Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reset SqLite database in Android?

Tags:

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 and recreate the database.

like image 428
Roland Avatar asked Jan 30 '14 13:01

Roland


People also ask

How delete all data from SQLite table in Android?

sqlite> DELETE FROM table_name; Following is the basic syntax of DROP TABLE. sqlite> DROP TABLE table_name; If you are using DELETE TABLE command to delete all the records, it is recommended to use VACUUM command to clear unused space.

How can I recover SQLite database in Android?

We can retrieve anything from database using an object of the Cursor class. We will call a method of this class called rawQuery and it will return a resultset with the cursor pointing to the table. We can move the cursor forward and retrieve the data. This method return the total number of columns of the table.


1 Answers

Just delete your database by

context.deleteDatabase(DATABASE_NAME); 

Please make sure to close your database before deleting.

like image 123
Linga Avatar answered Oct 18 '22 03:10

Linga