protected boolean isLockedException ( SQLiteException maybeLocked ) { try { if ( Class . forName ( "android.database.sqlite.SQLiteDatabaseLockedException" , false , getClass ( ) . getClassLoader ( ) ) . isAssignableFrom ( maybeLocked . getClass ( ) ) ) { return true ; } } catch ( ClassNotFoundException e ) { // no android.database.sqlite.SQLiteDatabaseLockedException } return false ; }
Returns true if the exception is an instance of SQLiteDatabaseLockedException . Since this exception does not exist in APIs below 11 this code uses reflection to check the exception type .