Reputation: 11116
The code below fills the spinner with data but when i select an item in the spinner no event is triggered. Any ideas ?
spinner itself is inside of toolbar
toolbar_spinner_item
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:singleLine="true"
android:layout_width="150dp"
android:layout_height="48dp"
android:ellipsize="marquee"
android:background="@color/white"
android:textColor="@color/dark_grey"/>
some activity onCreate
ArrayAdapter spinnerAdapter = ArrayAdapter.createFromResource(getApplicationContext(), R.array.date_ranges, android.R.layout.simple_spinner_dropdown_item);
spinnerAdapter.setDropDownViewResource(R.layout.toolbar_spinner_item);
Spinner spinner = (Spinner)findViewById(R.id.toolbar_spinner);
spinner.setAdapter(spinnerAdapter);
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
return;
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
return;
}
});
Upvotes: 0
Views: 167
Reputation: 7371
Just turning my comment into an answer ;-)
Instead of adding return;
try to add a Log.d
call for instance and see if it writes the log statement.
If you're using Android Studio, sometimes it skips certain lines when debugging.
Upvotes: 3