I am using SQLite database in my application.I want to remove/delete the database but unable to do so.I have checked the location of the database and it is present at /data/data/org.secure.sms/databases but when i tried to delete it,it was not successful.Please help me. This is the code:
public static void DeleteDatabase(Context context)
{
try
{
String filePath = context.getFilesDir()+ File.separator + "contactsManager";
String filePath1 = context.getFilesDir()+ File.separator + "database";
String filePath2 = context.getFilesDir()+ File.separator + "databases";
context.deleteDatabase(filePath);
context.deleteDatabase(filePath1);
context.deleteDatabase(filePath2);
File file = new File(filePath);
File file1 = new File( filePath1 );
context.deleteFile(file.getName());
context.deleteFile(file1.getName());
}
catch(Exception e)
{
Toast.makeText(context,"Exception in DeleteDatabase",Toast.LENGTH_SHORT).show();
}
}
Please help me.Thanks in advance.