Android examples for Database:Database Open
check Database file to see if it is openable
//package com.java2s; import android.content.Context; import android.database.sqlite.SQLiteDatabase; public class Main { private static final String DB_PATH_SUFFIX = "/databases/"; private static final String DATABASE_NAME = "mtetno.db"; private static Context mContext; private static boolean checkDatabase() { SQLiteDatabase checkDB = null;//from w ww. j av a 2s. c o m try { try { String myPath = getDatabasePath(); checkDB = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY); checkDB.close(); } catch (Exception e) { } } catch (Throwable ex) { } return checkDB != null ? true : false; } private static String getDatabasePath() { return mContext.getApplicationInfo().dataDir + DB_PATH_SUFFIX + DATABASE_NAME; } }