Buggy code:
public class AZoTriggerServiceActivity extends Activity { @ Override public void onCreate ( Bundle savedInstanceState ) { } @ Override protected void onResume ( ) { super . onResume ( ) ; final History history = new History ( getApplication ( ) ) ; final Activity myActivity = this ; final NumberPicker numberOfexposuresPicker = ( ( NumberPicker ) ( findViewById ( numberOfExposuresPicker ) ) ) ; numberOfexposuresPicker . setMinValue ( 1 ) ; numberOfexposuresPicker . setMaxValue ( 999 ) ; <START_BUG> numberOfexposuresPicker . setValue ( 10 ) ; <END_BUG> Button numberOfExposuresHistory = ( ( Button ) ( findViewById ( numberOfExposuresHistoryButton ) ) ) ; numberOfExposuresHistory . setOnClickListener ( new View . OnClickListener ( ) { public void onClick ( View arg0 ) { ListPopupWindow lpw = new ListPopupWindow ( myActivity ) ; lpw . setAdapter ( new android . widget . ArrayAdapter ( myActivity , layout . history_list_item , history . getHistory ( NUMBER_OF_EXPOSURES , "10" ) ) ) ; lpw . setOnItemClickListener ( new AdapterView . OnItemClickListener ( ) { public void onItemClick ( AdapterView < ? > arg0 , View arg1 , int arg2 , long arg3 ) { numberOfexposuresPicker . setValue ( Integer . parseInt ( history . getHistory ( NUMBER_OF_EXPOSURES , "10" ) . get ( arg2 ) ) ) ; } public void onNothingSelected ( AdapterView < ? > arg0 ) { } } ) ; lpw . setAnchorView ( findViewById ( numberOfExposuresHistoryButton ) ) ; lpw . setModal ( true ) ; lpw . show ( ) ; } } ) ; final TimePicker exposureTimePicker = ( ( TimePicker ) ( findViewById ( exposureTimePicker ) ) ) ; exposureTimePicker . setIs24HourView ( true ) ; exposureTimePicker . setTimeInMs ( 4000 ) ; final Button exposureHistoryButton = ( ( Button ) ( findViewById ( exposureHistoryButton ) ) ) ; exposureHistoryButton . setOnClickListener ( new View . OnClickListener ( ) { public void onClick ( View arg0 ) { AZoTriggerServiceActivity . showHistoryPopup ( myActivity , exposureHistoryButton , EXPOSURE , exposureTimePicker ) ; } } ) ; final TimePicker initialDelayTimePicker = ( ( TimePicker ) ( findViewById ( initialDelayPicker ) ) ) ; initialDelayTimePicker . setIs24HourView ( true ) ; initialDelayTimePicker . setTimeInMs ( 3000 ) ; final Button initialDelayHistoryButton = ( ( Button ) ( findViewById ( initialDelayHistoryButton ) ) ) ; initialDelayHistoryButton . setOnClickListener ( new View . OnClickListener ( ) { public void onClick ( View arg0 ) { AZoTriggerServiceActivity . showHistoryPopup ( myActivity , initialDelayHistoryButton , INITIAL_DELAY , initialDelayTimePicker ) ; } } ) ; final TimePicker exposureGapTimePicker = ( ( TimePicker ) ( findViewById ( exposureGapPicker ) ) ) ; exposureGapTimePicker . setIs24HourView ( true ) ; exposureGapTimePicker . setTimeInMs ( 0 ) ; final Button exposureGapHistoryButton = ( ( Button ) ( findViewById ( exposureGapHistoryButton ) ) ) ; exposureGapHistoryButton . setOnClickListener ( new View . OnClickListener ( ) { public void onClick ( View arg0 ) { AZoTriggerServiceActivity . showHistoryPopup ( myActivity , exposureGapHistoryButton , EXPOSURE_GAP_NUMBER , exposureGapTimePicker ) ; } } ) ; final EditText projectEditText = ( ( EditText ) ( findViewById ( projectEditText ) ) ) ; projectEditText . setText ( history . getHistory ( PROJECT , "Noname<seq2seq4repair_space>Project" ) . getFirst ( ) ) ; final Button projectHistoryButton = ( ( Button ) ( findViewById ( projectHistoryButton ) ) ) ; projectHistoryButton . setOnClickListener ( new View . OnClickListener ( ) { public void onClick ( View arg0 ) { final History history = new History ( myActivity . getApplication ( ) ) ; ListPopupWindow lpw = new ListPopupWindow ( myActivity ) ; lpw . setAdapter ( new android . widget . ArrayAdapter ( myActivity , layout . history_list_item , history . getHistory ( PROJECT , "Noname<seq2seq4repair_space>Project" ) ) ) ; lpw . setOnItemClickListener ( new AdapterView . OnItemClickListener ( ) { public void onItemClick ( AdapterView < ? > arg0 , View arg1 , int arg2 , long arg3 ) { projectEditText . setText ( history . getHistory ( PROJECT , "Noname<seq2seq4repair_space>Project" ) . get ( arg2 ) ) ; } public void onNothingSelected ( AdapterView < ? > arg0 ) { } } ) ; lpw . setAnchorView ( projectHistoryButton ) ; lpw . setModal ( true ) ; lpw . show ( ) ; } } ) ; final EditText seriesEditText = ( ( EditText ) ( findViewById ( seriesEditText ) ) ) ; seriesEditText . setText ( history . getHistory ( SERIES_NAME , "flats" ) . getFirst ( ) ) ; final Button seriesHistoryButton = ( ( Button ) ( findViewById ( seriesHistoryButton ) ) ) ; seriesHistoryButton . setOnClickListener ( new View . OnClickListener ( ) { public void onClick ( View arg0 ) { final History history = new History ( myActivity . getApplication ( ) ) ; ListPopupWindow lpw = new ListPopupWindow ( myActivity ) ; lpw . setAdapter ( new android . widget . ArrayAdapter ( myActivity , layout . history_list_item , history . getHistory ( SERIES_NAME , "flats" ) ) ) ; lpw . setOnItemClickListener ( new AdapterView . OnItemClickListener ( ) { public void onItemClick ( AdapterView < ? > arg0 , View arg1 , int arg2 , long arg3 ) { projectEditText . setText ( history . getHistory ( SERIES_NAME , "flats" ) . get ( arg2 ) ) ; } public void onNothingSelected ( AdapterView < ? > arg0 ) { } } ) ; lpw . setAnchorView ( seriesHistoryButton ) ; lpw . setModal ( true ) ; lpw . show ( ) ; } } ) ; Button viewJobListButton = ( ( Button ) ( findViewById ( viewjoblist ) ) ) ; viewJobListButton . setOnClickListener ( new View . OnClickListener ( ) { public void onClick ( View arg0 ) { Intent intent = new Intent ( myActivity , AZoJobListActivity . class ) ; startActivity ( intent ) ; } } ) ; Button triggerButton = ( ( Button ) ( findViewById ( trigger ) ) ) ;

Fix:
numberOfexposuresPicker . setValue ( Integer . parseInt ( history . getHistory ( NUMBER_OF_EXPOSURES , "10" ) . getFirst ( ) ) ) ;