how to add item to Spinner's ArrayAdapter?

前端 未结 4 1249
渐次进展
渐次进展 2020-12-30 05:21

i had a EditText , a button and a spinner . When click the button , the spinner will add a new item with name you entered in the EditText. But here is the question, my adap

4条回答
  •  感情败类
    2020-12-30 06:21

    I believe this is working as designed, but not as expected. ArrayAdapter used to only take an array, but the list constructor was added later. I'm guessing its just doing a toArray() on your list. This is why you have to either call add on the adapter, or create a new adapter when your List changes.

提交回复
热议问题