Reputation: 163
I have an array and I was wondering how I could get it into a spinner that is also in a alert dialog? I know this is a 2 part question but if anyone can help me with one of them it will be much appreciated.
Upvotes: 0
Views: 346
Reputation: 5389
Let's say your array is called spinnerArray, you can use a ArrayAdapter to talk to the spinner::
Spinner spinner = new Spinner(this);
ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>
(this,android.R.layout.simple_spinner_dropdown_item, spinnerArray);
spinner.setAdapter(spinnerArrayAdapter);
For dialogs, there is already a few questions related to using spinners in them.
Upvotes: 1