Reputation: 1859
I have a spinner that is created using the resource file statically. now i want to dynamically add a value to the spinner. Is this possible?
Upvotes: 1
Views: 694
Reputation: 3228
Assuming your code looks something like step 4 in this Hello Spinner example (that is, you have a programmatic reference to your Spinner using the id from your XML layout and are using an ArrayAdapter as your data source), you should be able to call add() on your ArrayAdapter and then call notifyDataSetChanged() on it as well to have your Spinner update itself.
Upvotes: 3