how to delete the database in Android?
I need to delete the database fil开发者_Go百科e.Here is my code to delete the file.
String strDBFilePath="/data/data/snow.AppStore/databases/"+strAppDBName;
File file = new File(strDBFilePath);
file.delete();
But it i can't delete the DB file.How to delete DB ????
A couple of questions.
- You are the developer of the snow App, or is it just an app for which you want to remove the database? If it's the latter you can do a 'clear data' in the 'manage applications' menu in the Android settings.
- Presuming you are the developer, why do you want to remove the database? For development purposes? If so you can connect your (virtual) device and remove the database via a file explorer? See the section on the file explorer in this article
- Why do you want to do it programmatically? Will it be a recurring task? You can also try the deleteDatabase method defined on the Context class
Good luck!
Johan
You can only delete your own database file. Also I do not believe dots in the folder names are allowed and you do not need to do that since it gets deleted automatically when the app is deleted. Whats your use case?
精彩评论