How can you set the event listener for a Spinner when the selected item changes?
Basically what I am trying to do is something similar to this:
spinn
This will work intialize the spinner and findviewbyid and use this it will work
Spinner schemeStatusSpinner;
schemeStatusSpinner = (Spinner) dialog.findViewById(R.id.spinner);
schemeStatusSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView> parentView, View selectedItemView, int position, long id) {
// your code here
if(schemeStatusSpinner.getSelectedItemId()==4){
reasonll.setVisibility(View.VISIBLE);
}
else {
reasonll.setVisibility(View.GONE);
}
}
@Override
public void onNothingSelected(AdapterView> parentView) {
// your code here
}
});