Buggy code:
public class ConvKeysFragment extends Fragment implements OnConvertKeyUpdateFinishedListener { ConvKeysFragment . OnConvertKeySelectedListener mCallback ; public interface OnConvertKeySelectedListener { public void updateScreen ( boolean updateResult ) { } } @ Override public void onAttach ( Activity activity ) { } private static final String EXTRA_UNIT_TYPE_POS = "com.llamacorp.equate.unit_type_pos" ; private UnitType mUnitType ; private ArrayList < Button > mConvButton ; private int mNumConvButtons ; private int [ ] convertButtonIds = new int [ ] { id . convert_button1 , id . convert_button2 , id . convert_button3 , id . convert_button4 , id . convert_button5 , id . convert_button6 , id . convert_button7 , id . convert_button8 , id . convert_button9 , id . convert_button10 } ; @ Override public void onCreate ( Bundle savedInstanceState ) { } @ Override public void onResume ( ) { } public static ConvKeysFragment newInstance ( int unitTypePos ) { } @ Override public View onCreateView ( LayoutInflater inflater , ViewGroup parent , Bundle savedInstanceState ) { View v = inflater . inflate ( fragment_convert_keys , parent , false ) ; mConvButton = new ArrayList < Button > ( ) ; mNumConvButtons = convertButtonIds . length ; if ( ( mUnitType . size ( ) ) > ( convertButtonIds . length ) ) { mNumConvButtons = ( mNumConvButtons ) - 1 ; Button button = ( ( Button ) ( v . findViewById ( convertButtonIds [ mNumConvButtons ] ) ) ) ; button . setText ( getText ( more_button ) ) ; button . setTypeface ( null , ITALIC ) ; button . setOnClickListener ( new View . OnClickListener ( ) { @ Override public void onClick ( View view ) { <START_BUG> createMoreUnitsDialog ( getText ( more_button ) , new DialogInterface . OnClickListener ( ) { <END_BUG> @ Override public void onClick ( DialogInterface dialog , int item ) { clickUnitButton ( ( item + ( mNumConvButtons ) ) ) ; } } ) ; } } ) ; } for ( int i = 0 ; i < ( mNumConvButtons ) ; i ++ ) { Button button = ( ( Button ) ( v . findViewById ( convertButtonIds [ i ] ) ) ) ; if ( ( mUnitType . size ( ) ) > ( mNumConvButtons ) ) ( ( SecondaryTextButton ) ( button ) ) . setSecondaryText ( ( ( String ) ( getText ( conv_button_hint ) ) ) ) ; mConvButton . add ( button ) ; if ( mUnitType . getUnitDisplayName ( i ) . equals ( "" ) ) continue ; refreshButtonText ( i ) ; button . setOnClickListener ( new View . OnClickListener ( ) { @ Override public void onClick ( View view ) { int viewId = view . getId ( ) ; for ( int i = 0 ; i < ( mNumConvButtons ) ; i ++ ) { if ( ( convertButtonIds [ i ] ) == viewId ) { clickUnitButton ( i ) ; break ; } } } } ) ; final int buttonPos = i ; button . setOnLongClickListener ( new View . OnLongClickListener ( ) { @ Override public boolean onLongClick ( View view ) { if ( ( mUnitType . size ( ) ) <= ( mNumConvButtons ) ) return true ; String title = ( ( ( ( ( getText ( word_Change ) ) + "<seq2seq4repair_space>" ) + ( mUnitType . getLowercaseGenericLongName ( buttonPos ) ) ) + "<seq2seq4repair_space>" ) + ( getText ( word_to ) ) ) + ":" ; createMoreUnitsDialog ( title , new DialogInterface . OnClickListener ( ) { @ Override public void onClick ( DialogInterface dialog , int item ) { mUnitType . swapUnits ( buttonPos , ( item + ( mNumConvButtons ) ) ) ; refreshButtonText ( buttonPos ) ; } } ) ; return false ; } } ) ; } return v ; } public void selectUnit ( Unit unit ) { } public void updateDynamicUnitButtons ( String text ) { } private void createMoreUnitsDialog ( CharSequence title , DialogInterface . OnClickListener itemClickListener ) { } private void refreshButtonText ( int buttonPos ) { } private void refreshButtonText ( String textPrefix , int buttonPos ) { } private void clickUnitButton ( final int buttonPos ) { } private void tryConvert ( int buttonPos ) { } private void colorSelectedButton ( ) { } public void clearButtonSelection ( ) { } private void setButtonHighlight ( boolean highlighted ) { } }

Fix:
createMoreUnitsDialog ( getText ( select_unit ) , new DialogInterface . OnClickListener ( ) {