static String[] list = new String[20];
for (int i=0; i<20; i++)
{
if (choice.getSelectedIndex() = list[i])
{
qty.setText(list[i+1]);
price.setText(list[i+2]);
}
}
how do i get the text of a dropdown menu?
i need to do comparison of value between the choice n array
e.g
in dropdown menu choice, the value is "red" then compare against the array list[20] -->list[5]="red"
I'm not sure what choice is an instance of, but if you want to compare two Strings, you shouldn't do like
if (choice.getSelectedIndex() = list[i])
because that's not even comparing.
if (choice.getSelectedIndex() == list[i])
is comparing, but it won't work on String variables, since they are not primitive types, they are objects.
if (choice.getSelectedIndex().equals(list[i])
is what you should use...