String[] klassen = {"3ECa1", "3ECa2", "3ECb", "3WEa", "3WEb", "3STWa", "3STWb", "3STWc"};
String[] klassen2 = {"4ECa", "4ECb", "4WE", "4STWa", "4STWb", "4STWc", "1Okan", "2Okan"};
String[] klassen3 = {"5EM", "5EW", "5MW", "5WW", "5STWa", "5STWb", "5STWc", "1Okan"};
String[] klassen4 = {"6EM", "6EW", "6MW", "6WW", "6STWa", "6STWb", "6STWc", "2Okan"};
List<String> klassenList = Arrays.asList(klassen);
public boolean onOptionsItemSelected(MenuItem item){
int id = item.getItemId();
switch(id){
case R.id.jaren_3de:
klassenList = Arrays.asList(klassen);
break;
case R.id.jaren_4de:
klassenList = Arrays.asList(klassen2);
break;
case R.id.jaren_5de:
klassenList = Arrays.asList(klassen3);
break;
case R.id.jaren_6de:
klassenList = Arrays.asList(klassen4);
break;
// case R.id.
}
return super.onOptionsItemSelected(item);
}
So I'm trying to change the value of the List klassenList inside my onOptionsItemSelected method.
R.id.jaren_*de
These are the menu items that I have to click to change the buttons on screen to the desired text (the klassen* arrays). The buttons are all done using an adapter, that needs
List<String> klassenList;
This, however, isn't working. It isn't giving any errors (except a null exception error when I don't assign a value to klassenList, but I know why that happens). It just doesn't change the text of the buttons and I can't find any solution to it.
Thanks in advance!