delete DataBase by database name - Android Database

Android examples for Database:Database File

Description

delete DataBase by database name

Demo Code


//package com.book2s;
import android.content.Context;
import java.io.File;

public class Main {
    public static void deleteDataBase(Context context, String dbName) {
        String databasePath = context.getApplicationInfo().dataDir
                + "/databases/" + dbName;
        File file = new File(databasePath);
        if (file.exists()) {
            file.delete();//from   w  w  w.  j  a va 2 s  .  co  m
        }
    }
}

Related Tutorials