database Exists via database name - Android Database

Android examples for Database:Table Exists

Description

database Exists via database name

Demo Code


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

public class Main {
    public static boolean databaseExists(Context context, String dbName) {
        File database = context.getApplicationContext().getDatabasePath(
                dbName);/*from   w  w w .ja  v  a2 s .co  m*/

        if (!database.exists()) {

            return false;
        } else {
            return true;
        }

    }
}

Related Tutorials