i have a spinner which i catch onClick like that:
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
position = pos;
}
public void onNothingSelected(AdapterView<?> arg0) {
}
I want to check if String for example String example = "example"
is in the Spinner ItemList and get its position, Is it possible?
with
spinner.getSelectedItem().toString();
you can get the Text which is currently selected. with
spinner.getSelectedItemPosition();
you can get the current position. You can compare the selected String like this:
if(spinner.getSelectedItem().toString().equals("example")){
//do something
};