Code example for SQLiteOpenHelper

Methods: getReadableDatabase

0
     * @param helper 
     * @return readable database or null if it failed to create/open 
     */ 
    protected SQLiteDatabase getReadable(SQLiteOpenHelper helper) {
        try { 
            return helper.getReadableDatabase();
        } catch (SQLiteException e1) {
            // Make second attempt 
            try { 
                return helper.getReadableDatabase();
            } catch (SQLiteException e2) {
                return null; 
            } 
        } 
    } 
 
    /** 
     * Load or request given resources 
     * 
     * @param persistableResource 
     * @return resource