10

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..

1
  • we can't help unless you post your code. Commented Dec 21, 2011 at 6:13

3 Answers 3

12

u can delete database manually by clear Data.

settings\applications\manage Applications\'select your application'\clear data.
Sign up to request clarification or add additional context in comments.

1 Comment

this will delete more than the database.
9

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:

  1. Choose your device.
  2. In the file tree navigate to /data/data/{your_package_name}/databases.
  3. 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's my_app.db.

Here's a screenshot:

Here's a screenshot

Comments

2

There is a function to delete DB :

https://developer.android.com/reference/android/content/Context.html#deleteDatabase(java.lang.String)

context.deleteDatabase(dbFileName)

It's that short...

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.