Hi, i want to disable a button when item on spinner is choosing.
Below is a coding, i failed to disable a button, can anybody can help
me?
Spinner spinner_OutputLanguage;
spinner_OutputLanguage = (Spinner)
findViewById(R.id.spinner_OutputLanguage);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner_OutputLanguage.setAdapter(adapter);
spinner_OutputLanguage.setOnItemSelectedListener(new
MyOnItemSelectedListener());
public class MyOnItemSelectedListener implements
OnItemSelectedListener {
public void onItemSelected(AdapterView<?> parent,
View view, int pos, long id) {
choice =
(String)spinner_OutputLanguage.getItemAtPosition((int)
spinner_OutputLanguage.getSelectedItemId());
if(choice!="ENGLISH")
{
button1.setEnabled(false);
}
if(choice!="GERMAN")
{
button1.setEnabled(false);
}
Toast.makeText(parent.getContext(), "The planet is " +
parent.getItemAtPosition(pos).toString(),
Toast.LENGTH_LONG).show();
}
public void onNothingSelected(AdapterView parent) {
// Do nothing.
}
}
Thank you.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en