Buggy code:
public class RepresentationFragment extends Fragment { private static Activity activity ; static JSONObject representation ; static View inflator ; public RepresentationFragment ( ) { } @ Override public void onCreate ( Bundle savedInstanceState ) { } @ Override public View onCreateView ( LayoutInflater inflater , ViewGroup container , Bundle savedInstanceState ) { } public static void setRepresentations ( JSONObject representations ) { } public static void addRepresentations ( String day , JSONArray data ) throws JSONException { TableLayout table = ( ( TableLayout ) ( ( day . equals ( "today" ) ) ? RepresentationFragment . inflator . findViewById ( representationsToday ) : RepresentationFragment . inflator . findViewById ( representationsTomorrow ) ) ) ; for ( int i = 0 ; i < ( data . length ( ) ) ; i ++ ) { JSONObject representation = data . getJSONObject ( i ) ; int lesson = representation . getInt ( "lesson" ) ; String subject = representation . getString ( "subject" ) ; String teacher = representation . getString ( "teacher" ) ; String room = representation . getString ( "room" ) ; TableRow row = new TableRow ( RepresentationFragment . activity ) ; if ( ( i % 2 ) == 1 ) row . setBackgroundColor ( ContextCompat . getColor ( RepresentationFragment . activity , grey ) ) ; row . setGravity ( CENTER ) ; row . setWeightSum ( 4 ) ; TextView lessonView = new TextView ( RepresentationFragment . activity ) ; TextView subjectView = new TextView ( RepresentationFragment . activity ) ; TextView teacherView = new TextView ( RepresentationFragment . activity ) ; TextView roomView = new TextView ( RepresentationFragment . activity ) ; int subjectId = Helper . getSubjectId ( subject ) ; String subjectString = ( subjectId == 0 ) ? subject : RepresentationFragment . activity . getString ( subjectId ) ; <START_BUG> lessonView . setText ( String . valueOf ( lesson ) ) ; <END_BUG> subjectView . setText ( subjectString ) ; teacherView . setText ( teacher ) ; roomView . setText ( room ) ; lessonView . setPadding ( 8 , 8 , 8 , 8 ) ; subjectView . setPadding ( 8 , 8 , 8 , 8 ) ; teacherView . setPadding ( 8 , 8 , 8 , 8 ) ; roomView . setPadding ( 8 , 8 , 8 , 8 ) ; lessonView . setGravity ( CENTER ) ; subjectView . setGravity ( CENTER ) ; teacherView . setGravity ( CENTER ) ; roomView . setGravity ( CENTER ) ; TableRow . LayoutParams params = new TableRow . LayoutParams ( LayoutParams . WRAP_CONTENT , LayoutParams . WRAP_CONTENT , 1.0F ) ; lessonView . setLayoutParams ( params ) ; subjectView . setLayoutParams ( params ) ; teacherView . setLayoutParams ( params ) ; roomView . setLayoutParams ( params ) ; row . addView ( lessonView ) ; row . addView ( subjectView ) ; row . addView ( teacherView ) ; row . addView ( roomView ) ; table . addView ( row ) ; } if ( ( data . length ( ) ) > 0 ) { if ( day . equals ( "today" ) ) { TextView noToday = ( ( TextView ) ( RepresentationFragment . inflator . findViewById ( noToday ) ) ) ; noToday . setVisibility ( GONE ) ; } else { TextView noTomorrow = ( ( TextView ) ( RepresentationFragment . inflator . findViewById ( noTomorrow ) ) ) ; noTomorrow . setVisibility ( GONE ) ; } } } public static void clearRepesentations ( ) { } public static void setDates ( String today , String tomorrow ) { } public static void setActivity ( Activity activity ) { } }

Fix:
lessonView . setText ( RepresentationFragment . activity . getString ( Helper . getLessonId ( lesson ) ) ) ;