database Exists - Android Database

Android examples for Database:Table Exists

Description

database Exists

Demo Code


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

public class Main {
    public static boolean databaseExists(Context context, String dbName) {
        String databasePath = context.getApplicationInfo().dataDir
                + "/databases/" + dbName;
        File dbFile = context.getDatabasePath(databasePath);
        return dbFile.exists();
    }/* ww  w  .  j ava  2s. c o  m*/
}

Related Tutorials