Buggy code:
i ++ ) { toAppendBuilder . append ( p1Team [ i ] ) . append ( "//" ) ; } toAppendBuilder . append ( p1Team [ ( ( p1Team . length ) - 1 ) ] ) ; toAppendBuilder . append ( "\n" ) . append ( battleFragment . getPlayer2 ( ) ) . append ( "'s<seq2seq4repair_space>Team:<seq2seq4repair_space>" ) ; String [ ] p2Team = battleFragment . getTeamNameStringArray ( team2 ) ; for ( int i = 0 ; i < ( ( p2Team . length ) - 1 ) ; i ++ ) { toAppendBuilder . append ( p2Team [ i ] ) . append ( "//" ) ; } toAppendBuilder . append ( p2Team [ ( ( p2Team . length ) - 1 ) ] ) ; toAppendSpannable = new SpannableStringBuilder ( toAppendBuilder ) ; logMessage = new SpannableString ( toAppendSpannable ) ; break ; case "request" : try { JSONObject requestJson = new JSONObject ( messageDetails ) ; if ( ( ( requestJson . length ( ) ) == 1 ) && ( requestJson . keys ( ) . next ( ) . equals ( "side" ) ) ) { battleFragment . setBattling ( requestJson ) ; JSONObject sideJson = requestJson . getJSONObject ( "side" ) ; JSONArray teamJson = sideJson . getJSONArray ( "pokemon" ) ; for ( int i = 0 ; i < ( teamJson . length ( ) ) ; i ++ ) { JSONObject info = teamJson . getJSONObject ( i ) ; final PokemonInfo pkm = BattleMessage . parsePokemonInfo ( battleFragment , info ) ; if ( ( battleFragment . findPokemonInTeam ( battleFragment . getPlayer1Team ( ) , pkm . getName ( ) ) ) == ( - 1 ) ) { battleFragment . getPlayer1Team ( ) . add ( i , pkm ) ; battleFragment . getActivity ( ) . runOnUiThread ( new Runnable ( ) { @ Override public void run ( ) { int pkmIcon = Pokemon . getPokemonIcon ( battleFragment . getActivity ( ) , MyApplication . toId ( pkm . getName ( ) ) ) ; int iconId = battleFragment . getIconId ( "p1" , ( ( battleFragment . getPlayer1Team ( ) . size ( ) ) - 1 ) ) ; if ( ( battleFragment . getView ( ) ) == null ) { viewData . addViewSetterOnHold ( iconId , pkmIcon , IMAGEVIEW_SETIMAGERESOURCE ) ; } else { ImageView icon = ( ( ImageView ) ( battleFragment . getView ( ) . findViewById ( iconId ) ) ) ; if ( icon != null ) { icon . setImageResource ( pkmIcon ) ; } } } } ) ; } else { battleFragment . getPlayer1Team ( ) . set ( i , pkm ) ; } } } if ( requestJson . has ( "side" ) ) { JSONObject sideJson = requestJson . getJSONObject ( "side" ) ; JSONArray teamJson = sideJson . getJSONArray ( "pokemon" ) ; for ( int i = 0 ; i < ( teamJson . length ( ) ) ; i ++ ) { JSONObject pkm = teamJson . getJSONObject ( i ) ; battleFragment . getPlayer1Team ( ) . get ( i ) . setActive ( pkm . getBoolean ( "active" ) ) ; } } battleFragment . setRqid ( requestJson . optInt ( "rqid" , 0 ) ) ; battleFragment . setTeamPreview ( requestJson . optBoolean ( "teamPreview" , false ) ) ; battleFragment . setWaiting ( requestJson . optBoolean ( "wait" , false ) ) ; if ( requestJson . has ( "forceSwitch" ) ) { JSONArray forceSwitchJsonArray = requestJson . getJSONArray ( "forceSwitch" ) ; int idx = 0 ; for ( PokemonInfo info : battleFragment . getPlayer1Team ( ) ) { if ( info . isActive ( ) ) { info . setForceSwitch ( forceSwitchJsonArray . getBoolean ( idx ) ) ; idx ++ ; } else { break ; } } } if ( ( ( battleFragment . getRqid ( ) ) != 0 ) && ( ! ( battleFragment . isTeamPreview ( ) ) ) ) { <START_BUG> battleFragment . startAction ( requestJson ) ; <END_BUG> } } catch ( JSONException e ) { new android . app . AlertDialog . Builder ( battleFragment . getActivity ( ) ) . setMessage ( request_error ) . create ( ) . show ( ) ; return ; } break ; case "inactive" : final String inactive ; final String player ; if ( ( messageDetails . startsWith ( battleFragment . getPlayer1 ( ) ) ) || ( messageDetails . startsWith ( "Player<seq2seq4repair_space>1" ) ) ) { player = "p1" ; } else { if ( ( messageDetails . startsWith ( battleFragment . getPlayer2 ( ) ) ) || ( messageDetails . startsWith ( "Player<seq2seq4repair_space>2" ) ) ) { player = "p2" ; } else { break ; } } if ( messageDetails . contains ( "<seq2seq4repair_space>seconds<seq2seq4repair_space>left" ) ) { remaining = messageDetails . substring ( 0 , messageDetails . indexOf ( "<seq2seq4repair_space>seconds<seq2seq4repair_space>left" ) ) ; inactive = ( remaining . substring ( remaining . lastIndexOf ( '<seq2seq4repair_space>' ) ) ) + "s" ; } else { break ; } battleFragment . getActivity ( ) . runOnUiThread ( new Runnable ( ) { @ Override public void run ( ) { if ( player . equals ( "p1" ) ) { if ( ( battleFragment . getView ( ) ) == null ) { viewData . addViewSetterOnHold ( inactive , inactive , TEXTVIEW_SETTEXT ) ; viewData . addViewSetterOnHold ( inactive , null , VIEW_VISIBLE ) ; } else { TextView textView = ( ( TextView ) ( battleFragment . getView ( ) . findViewById ( inactive ) ) ) ; textView . setVisibility ( VISIBLE ) ; textView . setText ( inactive ) ; } } else { if ( ( battleFragment . getView ( ) ) == null ) { viewData . addViewSetterOnHold ( inactive_o , inactive , TEXTVIEW_SETTEXT ) ;

Fix:
battleFragment . startAction ( requestJson . getJSONArray ( "active" ) ) ;