Buggy code:
else if ( CameraController . isModeAvailable ( supported_focus , AF_MODE_MACRO ) ) afMode = CameraParameters . AF_MODE_MACRO ; else afMode = supported_focus [ 0 ] ; CameraController . setCameraFocusMode ( afMode ) ; } else if ( ( mFocusMode ) == ( AlmalenceGUI . FOCUS_MF ) ) { CameraController . setCameraFocusDistance ( mFocusDistance ) ; ApplicationScreen . getPluginManager ( ) . sendMessage ( MSG_BROADCAST , MSG_FOCUS_LOCKED ) ; } else CameraController . setCameraFocusMode ( mFocusMode ) ; } else { mFocusModeSupported = false ; mFocusMode = - 1 ; } } else { mFocusMode = - 1 ; mFocusModeSupported = false ; } int [ ] supported_flash = CameraController . getSupportedFlashModes ( ) ; if ( ( ( ( supported_flash != null ) && ( ( supported_flash . length ) > 0 ) ) && ( ( activeFlash ) != null ) ) && ( ! ( ( ( supported_flash . length ) == 1 ) && ( CameraController . isModeAvailable ( supported_flash , FLASH_MODE_OFF ) ) ) ) ) { for ( int flash_name : supported_flash ) { if ( flashModeButtons . containsKey ( flash_name ) ) { activeFlash . add ( flashModeButtons . get ( Integer . valueOf ( flash_name ) ) ) ; activeFlashNames . add ( Integer . valueOf ( flash_name ) ) ; } } if ( ! ( activeFlashNames . isEmpty ( ) ) ) { mFlashModeSupported = true ; defaultQuickControl2 = String . valueOf ( AlmalenceGUI . MODE_FLASH ) ; flashmodeAdapter . Elements = activeFlash ; GridView gridview = ( ( GridView ) ( guiView . findViewById ( flashmodeGrid ) ) ) ; gridview . setAdapter ( flashmodeAdapter ) ; int initValue = preferences . getInt ( sFlashModePref , sDefaultFlashValue ) ; if ( ! ( activeFlashNames . contains ( initValue ) ) ) { if ( CameraController . isFrontCamera ( ) ) initValue = activeFlashNames . get ( 0 ) ; else initValue = ApplicationScreen . sDefaultFlashValue ; } setButtonSelected ( flashModeButtons , initValue ) ; setCameraParameterValue ( AlmalenceGUI . MODE_FLASH , initValue ) ; if ( ( ( AlmalenceGUI . ICONS_FLASH ) != null ) && ( AlmalenceGUI . ICONS_FLASH . containsKey ( initValue ) ) ) { RotateImageView but = ( ( RotateImageView ) ( topMenuButtons . get ( AlmalenceGUI . MODE_FLASH ) ) ) ; int icon_id = AlmalenceGUI . ICONS_FLASH . get ( initValue ) ; but . setImageResource ( icon_id ) ; } CameraController . setCameraFlashMode ( mFlashMode ) ; } else { mFlashModeSupported = false ; mFlashMode = - 1 ; } } else { mFlashModeSupported = false ; mFlashMode = - 1 ; } int [ ] supported_iso = CameraController . getSupportedISO ( ) ; if ( ( ( ( supported_iso != null ) && ( ( supported_iso . length ) > 0 ) ) && ( ( activeISO ) != null ) ) || ( ( CameraController . isISOSupported ( ) ) && ( ( activeISO ) != null ) ) ) { if ( ( supported_iso != null ) && ( ( supported_iso . length ) != 0 ) ) for ( int iso_name : supported_iso ) { if ( isoButtons . containsKey ( iso_name ) ) { activeISO . add ( isoButtons . get ( Integer . valueOf ( iso_name ) ) ) ; activeISONames . add ( Integer . valueOf ( iso_name ) ) ; } } else { for ( String iso_name : CameraController . getIsoDefaultList ( ) ) { activeISO . add ( isoButtons . get ( CameraController . getIsoKey ( ) . get ( iso_name ) ) ) ; activeISONames . add ( CameraController . getIsoKey ( ) . get ( iso_name ) ) ; } } if ( ! ( activeISONames . isEmpty ( ) ) ) { mISOSupported = true ; isoAdapter . Elements = activeISO ; GridView gridview = ( ( GridView ) ( guiView . findViewById ( isoGrid ) ) ) ; gridview . setAdapter ( isoAdapter ) ; <START_BUG> int initValue = preferences . getInt ( sISOPref , sDefaultValue ) ; <END_BUG> if ( ! ( activeISONames . contains ( initValue ) ) ) { if ( CameraController . isFrontCamera ( ) ) initValue = activeISONames . get ( 0 ) ; else initValue = ApplicationScreen . sDefaultValue ; preferences . edit ( ) . putInt ( sISOPref , initValue ) . commit ( ) ; } setButtonSelected ( isoButtons , initValue ) ; setCameraParameterValue ( AlmalenceGUI . MODE_ISO , initValue ) ; if ( ( ( AlmalenceGUI . ICONS_ISO ) != null ) && ( AlmalenceGUI . ICONS_ISO . containsKey ( initValue ) ) ) { RotateImageView but = ( ( RotateImageView ) ( topMenuButtons . get ( AlmalenceGUI . MODE_ISO ) ) ) ; int icon_id = AlmalenceGUI . ICONS_ISO . get ( initValue ) ; but . setImageResource ( icon_id ) ; } CameraController . setCameraISO ( mISO ) ; } else { mISOSupported = false ; mISO = - 1 ; } } else { mISOSupported = false ; mISO = - 1 ; } int iMeteringAreasSupported = CameraController . getMaxNumMeteringAreas ( ) ; if ( iMeteringAreasSupported > 0 ) { Collection < Integer > unsorted_keys = AlmalenceGUI . NAMES_METERING . keySet ( ) ; List < Integer > keys = Util . asSortedList ( unsorted_keys ) ; Iterator < Integer > it = keys . iterator ( ) ; while ( it . hasNext ( ) ) { int metering_name = it . next ( ) ; if ( ( ( metering_name == 3 ) || ( metering_name == 1 ) ) && ( ( MODEL . contains ( "SM-N900" ) ) || ( MODEL . contains ( "SM-G900" ) ) ) ) continue ; if ( meteringModeButtons . containsKey ( metering_name ) ) { activeMetering . add ( meteringModeButtons . get ( metering_name ) ) ; activeMeteringNames . add ( metering_name ) ; } }

Fix:
int initValue = preferences . getInt ( sISOPref , sDefaultISOValue ) ;