Buggy code:
public class ClassGradesActivity extends ActionBarActivity { private ListView gradesList ; public static final String SELECTED_COURSE_ID = "com.fruko.materialcampus.SELECTED_COURSE_ID" ; public static final String SELECTED_ASSIGNMENT_ID = "com.fruko.materialcampus.SELECTED_ASSIGNMENT_ID" ; public static final String SELECTED_CATEGORY_ID = "com.fruko.materialcampus.SELECTED_CATEGORY_ID" ; private Course course ; protected void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; setContentView ( activity_classgrades ) ; course = courses . get ( getIntent ( ) . getIntExtra ( ClassesActivity . SELECTED_COURSE_ID , 0 ) ) ; setTitle ( ( ( ( ( course . getCourseName ( ) ) + "<seq2seq4repair_space>-<seq2seq4repair_space>" ) + ( new DecimalFormat ( "#.00" ) . format ( course . getPercent ( ) ) ) ) + "%" ) ) ; getWindow ( ) . setSoftInputMode ( SOFT_INPUT_STATE_ALWAYS_HIDDEN ) ; final List < List < String [ ] > > gradesArray = new ArrayList < > ( ) ; for ( int i = 0 ; i < ( course . gradeCategories . size ( ) ) ; i ++ ) { Category c = course . gradeCategories . get ( i ) ; String [ ] title = new String [ ] { c . name , "" } ; List < String [ ] > category = new ArrayList < > ( ) ; category . add ( title ) ; for ( int j = 0 ; j < ( c . activities . size ( ) ) ; j ++ ) { Activity a = c . activities . get ( j ) ; String percent = "" ; if ( ( a . percentage ) == 0 ) percent = "0.00%" ; else percent = ( new DecimalFormat ( "#.00" ) . format ( a . percentage ) ) + "%" ; String [ ] assignment = new String [ ] { a . name , percent } ; category . add ( assignment ) ; } gradesArray . add ( category ) ; } gradesList = ( ( ListView ) ( findViewById ( class_grades ) ) ) ; final Context c = this ; gradesList . setAdapter ( new android . widget . ArrayAdapter < List < String [ ] > > ( this , layout . category_list_item , id . category , gradesArray ) { public View getView ( final int position , View convertView , ViewGroup parent ) { View view ; if ( convertView == null ) { LayoutInflater infl = ( ( LayoutInflater ) ( getSystemService ( LAYOUT_INFLATER_SERVICE ) ) ) ; convertView = infl . inflate ( category_list_item , parent , false ) ; } view = super . getView ( position , convertView , parent ) ; List < String [ ] > assignments = gradesArray . get ( position ) ; TextView name = ( ( TextView ) ( view . findViewById ( category ) ) ) ; name . setText ( assignments . get ( 0 ) [ 0 ] ) ; LinearLayout list = ( ( LinearLayout ) ( view . findViewById ( assignments ) ) ) ; list . removeAllViews ( ) ; for ( int i = 1 ; i < ( assignments . size ( ) ) ; i ++ ) { View child = getLayoutInflater ( ) . inflate ( assignment_list_item , null ) ; TextView assignName = ( ( TextView ) ( child . findViewById ( name ) ) ) ; assignName . setText ( assignments . get ( i ) [ 0 ] ) ; TextView grade = ( ( TextView ) ( child . findViewById ( grade ) ) ) ; grade . setText ( assignments . get ( i ) [ 1 ] ) ; <START_BUG> final int a = i ; <END_BUG> child . setOnClickListener ( new View . OnClickListener ( ) { @ Override public void onClick ( View view ) { Intent intent = new Intent ( c , AssignmentActivity . class ) ; intent . putExtra ( ClassGradesActivity . SELECTED_COURSE_ID , getIntent ( ) . getIntExtra ( ClassesActivity . SELECTED_COURSE_ID , 0 ) ) ; intent . putExtra ( ClassGradesActivity . SELECTED_CATEGORY_ID , position ) ; intent . putExtra ( ClassGradesActivity . SELECTED_ASSIGNMENT_ID , a ) ; startActivity ( intent ) ; } } ) ; list . addView ( child ) ; } return view ; } } ) ; } protected void onStart ( ) { } protected void onRestart ( ) { } protected void onResume ( ) { } protected void onPause ( ) { } protected void onStop ( ) { } protected void onDestroy ( ) { } @ Override public boolean onCreateOptionsMenu ( Menu menu ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } }

Fix:
final int a = i - 1 ;