Buggy code:
public class SelectionActivity extends ActionBarActivity { private Game game ; private SelectionView selectionView ; private TextView selectionText ; private Toast noBirdToast ; private Cloud cloud ; private Boolean birdSelected = false ; private Boolean stillMyTurn = true ; private String gameId = "" ; private int player ; @ Override protected void onSaveInstanceState ( Bundle bundle ) { } @ Override protected void onCreate ( final Bundle bundle ) { super . onCreate ( bundle ) ; setContentView ( activity_selection ) ; cloud = new Cloud ( ) ; if ( bundle != null ) { game = ( ( Game ) ( bundle . getSerializable ( getString ( game_state ) ) ) ) ; } else { game = ( ( Game ) ( getIntent ( ) . getExtras ( ) . getSerializable ( getString ( game_state ) ) ) ) ; } selectionView = ( ( SelectionView ) ( findViewById ( R . id . selectionView ) ) ) ; this . selectionText = ( ( TextView ) ( findViewById ( playerNameLabel ) ) ) ; setPlayerSelectionText ( ) ; gameId = getIntent ( ) . getStringExtra ( "gameId" ) ; final Context context = getApplicationContext ( ) ; CharSequence noBirdText = "Please<seq2seq4repair_space>select<seq2seq4repair_space>a<seq2seq4repair_space>bird!" ; int duration = Toast . LENGTH_SHORT ; noBirdToast = Toast . makeText ( context , noBirdText , duration ) ; TextView v = ( ( TextView ) ( noBirdToast . getView ( ) . findViewById ( message ) ) ) ; v . setTextColor ( RED ) ; boolean player1 = game . isPlayerOne ( ) ; if ( player1 ) { player = 1 ; } else { player = 2 ; } final Bundle newBundle = new Bundle ( ) ; new Thread ( new Runnable ( ) { @ Override public void run ( ) { while ( stillMyTurn ) { int serverTurn = Integer . parseInt ( cloud . GetCurTurn ( gameId ) . split ( "," ) [ 1 ] ) ; if ( ( game . getLocalTurn ( ) ) < serverTurn ) { String birdinfo = cloud . GetMovement ( gameId , game . getLocalTurn ( ) ) ; String [ ] result = birdinfo . split ( "," ) ; <START_BUG> if ( result [ 0 ] . equals ( "error" ) ) { <END_BUG> Log . i ( "getmovement" , "error" ) ; continue ; } else { if ( result [ 4 ] . equals ( "1" ) ) { } Bird serverBird = new Bird ( getBaseContext ( ) , Integer . parseInt ( result [ 1 ] ) , Float . parseFloat ( result [ 2 ] ) , Float . parseFloat ( result [ 3 ] ) ) ; game . AddBird ( serverBird ) ; } game . AddLocalTurn ( ) ; continue ; } if ( ( cloud . isMyTurn ( gameId , Integer . toString ( player ) ) ) && ( birdSelected ) ) { Log . i ( "BIRD<seq2seq4repair_space>SELECTED<seq2seq4repair_space>IF:<seq2seq4repair_space>" , ( "<seq2seq4repair_space>Value" + ( birdSelected ) ) ) ; stillMyTurn = false ; game . saveInstanceState ( newBundle , context ) ; Intent intent = new Intent ( getBaseContext ( ) , GameActivity . class ) ; intent . putExtra ( "gameId" , gameId ) ; intent . putExtras ( newBundle ) ; startActivity ( intent ) ; finish ( ) ; } else if ( ( cloud . isMyTurn ( gameId , Integer . toString ( player ) ) ) && ( ! ( birdSelected ) ) ) { setPlayerSelectionText ( ) ; Log . i ( "BIRD<seq2seq4repair_space>SELECTED<seq2seq4repair_space>IF<seq2seq4repair_space>ELSE:<seq2seq4repair_space>" , ( "<seq2seq4repair_space>Value" + ( birdSelected ) ) ) ; } else { Log . i ( "BIRD<seq2seq4repair_space>SELECTED<seq2seq4repair_space>ELSE:<seq2seq4repair_space>" , ( "<seq2seq4repair_space>Value" + ( birdSelected ) ) ) ; changeToWaitingText ( ) ; } try { Thread . sleep ( 1000 ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } } } } ) . start ( ) ; if ( bundle != null ) { Log . i ( "onCreate()" , "restoring<seq2seq4repair_space>state..." ) ; selectionView . loadInstanceState ( bundle ) ; } } @ Override public boolean onCreateOptionsMenu ( Menu menu ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } private void changeToWaitingText ( ) { } private void setPlayerSelectionText ( ) { } public void onConfirmSelection ( View view ) { } public int checkPlayerTurn ( ) { } }

Fix:
if ( ! ( result [ 0 ] . equals ( "yes" ) ) ) {