I have a question about how to set a text according to the chosen position of the spinner. I have an array of foods (rice, noodles, tuna, etc.) And the idea is that when you select, for example "Rice", a textview appears that says "The glycemic index of this food is 50" (For example). I ask you what would be the best method to do it. The way I can think of is to put:
String alimentosel=spinner1.getSelectedItem().toString();
if (selec.equals("arroz")) {
String arroz ="El indice glucemico es 50"
tv1.setText(arroz);
} else
So would it be correct?