views:

91

answers:

4

android code to delete the database from the application?

+4  A: 

Did you check deleteDatabase() method available in Android?

http://developer.android.com/intl/de/reference/android/content/ContextWrapper.html#deleteDatabase%28java.lang.String%29

Rahul
A: 

Do you need to delete the actual db file or is it enough to just DROP the tables? I'd imagine the end result is the same and dropping the tables could be easier.

onik
i want to delete the actual db file
Amit Thaper
+1  A: 
File dbFile = getDatabasePath("your_db_file_name");
boolean deleted = dbFile.delete();
radek-k
If your phone is not rooted and if your database is inside your application folder(data/data) i doubt whether this can delete it.
Rahul
You may delete it inside an application in which you created it.
radek-k