Code example for SQLiteException

0
        try { 
            mIsInitializing = true;
            String path = databaseDirectory(mContext) + File.separator + mName;
            db = SQLiteDatabase.openDatabase(path, mFactory, SQLiteDatabase.OPEN_READONLY | SQLiteDatabase.NO_LOCALIZED_COLLATORS);
            if (db.getVersion() != mNewVersion) {
                throw new SQLiteException("Can't upgrade read-only database from version " +
                        db.getVersion() + " to " + mNewVersion + ": " + path);
            } 
 
            onOpen(db);
            Log.w(TAG, "Opened " + mName + " in read-only mode");
            mDatabase = db;
            return mDatabase;
        } finally { 
            mIsInitializing = false;
            if (db != null && db != mDatabase) db.close();
        } 
    } 
 
    /** 
     * Close any open database object.