is There a database file - Android Database

Android examples for Database:Database File

Description

is There a database file

Demo Code


//package com.book2s;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;

public class Main {
    private static final String PATH = "data/data/com.fixd.app/databases/";
    private static final String NAME = "dtc.db";

    public static boolean isThereDB() {
        SQLiteDatabase db = null;/*w w w .  j  a v a  2s  .c om*/

        try {
            db = SQLiteDatabase.openDatabase(PATH + NAME, null,
                    SQLiteDatabase.OPEN_READONLY);
        } catch (SQLiteException e) {
            e.printStackTrace();
        }

        if (db != null) {
            db.close();
        }

        return (db == null ? false : true);
    }
}

Related Tutorials