Buggy code:
public class TestComplete extends ActionBarActivity { private final int [ ] testingFrequencies = new int [ ] { 1000 , 500 , 1000 , 3000 , 4000 , 6000 , 8000 } ; SimpleDateFormat sdf = new SimpleDateFormat ( "MM_dd_yyyy-HHmmss" ) ; String currentDateTime = sdf . format ( new Date ( ) ) ; @ Override protected void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; setContentView ( activity_test_complete ) ; if ( ( VERSION . SDK_INT ) >= ( VERSION_CODES . LOLLIPOP ) ) { getWindow ( ) . addFlags ( FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS ) ; getWindow ( ) . setStatusBarColor ( getResources ( ) . getColor ( primary_dark ) ) ; } byte [ ] testResultsRightByte = new byte [ 7 * 8 ] ; try { FileInputStream fis = openFileInput ( ( "TestResults-Right-" + ( currentDateTime ) ) ) ; fis . read ( testResultsRightByte , 0 , testResultsRightByte . length ) ; fis . close ( ) ; } catch ( IOException e ) { } final double [ ] testResultsRight = new double [ 7 ] ; int counter = 0 ; for ( int i = 0 ; i < ( testResultsRight . length ) ; i ++ ) { byte [ ] tmpByteBuffer = new byte [ 8 ] ; for ( int j = 0 ; j < 8 ; j ++ ) { tmpByteBuffer [ j ] = testResultsRightByte [ counter ] ; counter ++ ; } testResultsRight [ i ] = ByteBuffer . wrap ( tmpByteBuffer ) . getDouble ( ) ; } byte [ ] testResultsLeftByte = new byte [ 7 * 8 ] ; try { FileInputStream fis = openFileInput ( ( "TestResults-Left-" + ( currentDateTime ) ) ) ; fis . read ( testResultsLeftByte , 0 , testResultsLeftByte . length ) ; fis . close ( ) ; } catch ( IOException e ) { } final double [ ] testResultsLeft = new double [ 7 ] ; counter = 0 ; for ( int i = 0 ; i < ( testResultsLeft . length ) ; i ++ ) { byte [ ] tmpByteBuffer = new byte [ 8 ] ; for ( int j = 0 ; j < 8 ; j ++ ) { tmpByteBuffer [ j ] = testResultsLeftByte [ counter ] ; counter ++ ; } testResultsLeft [ i ] = ByteBuffer . wrap ( tmpByteBuffer ) . getDouble ( ) ; } TableLayout tableResults = ( ( TableLayout ) ( findViewById ( tableResults ) ) ) ; tableResults . setPadding ( 15 , 3 , 15 , 3 ) ; for ( int i = 0 ; i < 7 ; i ++ ) { TableRow row = new TableRow ( this ) ; TableLayout . LayoutParams lp = new TableLayout . LayoutParams ( LayoutParams . WRAP_CONTENT , LayoutParams . WRAP_CONTENT ) ; row . setLayoutParams ( lp ) ; row . setPadding ( 15 , 3 , 15 , 3 ) ; row . setBackgroundColor ( Color . parseColor ( "#424242" ) ) ; TextView Values = new TextView ( this ) ; Values . setPadding ( 15 , 0 , 15 , 0 ) ; Values . setGravity ( LEFT ) ; Values . setTextSize ( 25.0F ) ; Values . setTextColor ( Color . parseColor ( "#FFFFFF" ) ) ; Values . setText ( ( ( ( ( testingFrequencies [ i ] ) + "<seq2seq4repair_space>Hz:<seq2seq4repair_space>" ) + ( String . format ( "%.2f" , testResultsLeft [ i ] ) ) ) + "db<seq2seq4repair_space>HL<seq2seq4repair_space>Left" ) ) ; row . addView ( Values ) ; tableResults . addView ( row ) ; TableRow row2 = new TableRow ( this ) ; row2 . setLayoutParams ( lp ) ; row2 . setPadding ( 15 , 3 , 15 , 3 ) ; row2 . setBackgroundColor ( Color . parseColor ( "#424242" ) ) ; TextView Values2 = new TextView ( this ) ; Values2 . setPadding ( 15 , 0 , 15 , 0 ) ; Values2 . setGravity ( LEFT ) ; Values2 . setTextSize ( 25.0F ) ; Values2 . setTextColor ( Color . parseColor ( "#FFFFFF" ) ) ; Values2 . setText ( ( ( ( ( testingFrequencies [ i ] ) + "<seq2seq4repair_space>Hz:<seq2seq4repair_space>" ) + ( String . format ( "%.2f" , testResultsRight [ i ] ) ) ) + "db<seq2seq4repair_space>HL<seq2seq4repair_space>Right" ) ) ; <START_BUG> row2 . addView ( Values ) ; <END_BUG> tableResults . addView ( row2 ) ; } } @ Override public boolean onCreateOptionsMenu ( Menu menu ) { } public void gotoMain ( View view ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } }

Fix:
row2 . addView ( Values2 ) ;