Reputation: 1791
I am calling onItemSelectedListener
in my spinner but the code inside onItemSelected
is not being executed.
Here is my code:
final MaterialBetterSpinner materialDesignSpinner = (MaterialBetterSpinner)
findViewById(R.id.states_list);
ArrayAdapter<String> stateArrayAdapter = new ArrayAdapter<>(this,
android.R.layout.simple_dropdown_item_1line, getResources().getStringArray(R.array.oman_states));
materialDesignSpinner.setAdapter(stateArrayAdapter);
materialDesignSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
System.out.println("works");
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
System.out.println()
is not executed
What am I doing wrong here?
Upvotes: 0
Views: 119
Reputation: 18633
You want to use android.util.Log
instead of System.out
, which doesn't always work. See this.
Upvotes: 1