I'm trying to create a dynamic spinner (combobox), but I couldn't make it work, it is showing the first item in the spinner, but when I click it, the list with the other items is not showing and nothing is happening.
My activity xml:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="80dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:orientation="horizontal">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/global_languages"/>
<Spinner
android:id="@+id/localesSpinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:popupBackground="@color/facebookBlue"
android:clickable="true"/>
</LinearLayout>
I'm trying to set items this way:
private void loadLocalesSuccess(Collection<String> locales){
Spinner localesSpinner = (Spinner) findViewById(R.id.localesSpinner);
ArrayAdapter adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, new ArrayList(locales));
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
localesSpinner.setAdapter(adapter);
adapter.notifyDataSetChanged();
}
what could be the problem?