After deploying my application into android mobile,at starting the database is getting created. I do want to delete database tables in mobile.How to do that in mobile..
3 Answers
u can delete database manually by clear Data
.
settings\applications\manage Applications\'select your application'\clear data.
-
1
If you use Room Persistence Library
, then try to do the following (but maybe it also will work for other libraries, I haven't checked).
In Android Studio open View
-> Tool Windows
-> Device File Explorer
. Then in the Device File Explorer:
- Choose your device.
- In the file tree navigate to
/data/data/{your_package_name}/databases
. - Delete files which names match your database name (you give a name to your database when you build
RoomDatabase
in your code). In my case it'smy_app.db
.
Here's a screenshot:
There is a function to delete DB :
context.deleteDatabase(dbFileName)
It's that short...