public boolean isValueExistForKey ( String key ) { boolean isValueExists ; try { String string = getString ( key , "" ) ; isValueExists = ! string . equalsIgnoreCase ( "" ) ; } catch ( ClassCastException e ) { try { int anInt = getInt ( key , 0 ) ; isValueExists = anInt != 0 ; } catch ( ClassCastException e1 ) { try { long aLong = getLong ( key , 0 ) ; isValueExists = aLong != 0 ; } catch ( ClassCastException e2 ) { try { float aFloat = getFloat ( key , 0f ) ; isValueExists = aFloat != 0 ; } catch ( ClassCastException e3 ) { try { boolean aBoolean = getBoolean ( key , false ) ; isValueExists = ! aBoolean ; } catch ( Exception e4 ) { isValueExists = false ; e . printStackTrace ( ) ; } } } } } catch ( Exception e ) { isValueExists = false ; } return isValueExists ; }
Check if value exists for key .