There are specific scenario when we need to fill the android spinner from array list to dynamic fill the spinner data.
get the source from :
https://github.com/sapandang/AndroidFeatures/tree/master/app/src/main/java/skd/app/androidfeatures/dropdowns
//sppinnder data create arrary listArrayListarrayList = new ArrayList<>(); arrayList.add("yoo"); arrayList.add("bye bye"); arrayList.add("bye bye"); arrayList.add("bye bye"); arrayList.add("bye bye"); arrayList.add("bye bye"); arrayList.add("bye bye"); arrayList.add("bye bye"); arrayList.add("bye bye"); arrayList.add("bye bye"); arrayList.add("bye bye"); arrayList.add("bye bye"); arrayList.add("bye bye"); arrayList.add("bye bye"); arrayList.add("bye bye"); arrayList.add("bye bye"); arrayList.add("bye bye"); spinner = findViewById(R.id.spinner); //create array adapter and provide arrary list to itArrayAdapter arrayAdapter = new ArrayAdapter (this,android.R.layout.simple_spinner_item,arrayList); arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(arrayAdapter);
get the source from :
https://github.com/sapandang/AndroidFeatures/tree/master/app/src/main/java/skd/app/androidfeatures/dropdowns