How to update a spinner dynamically?

后端 未结 10 1157
北荒
北荒 2020-12-08 02:32

I\'ve been trying to update my spinner in android dynamically but nothing I try has been working.

This is the following code I\'m using to update the spinner.

10条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-08 03:10

    After you change your data, you will need to add the following code:

    typeList = dbAdapter.getList()              
    adapter = new ArrayAdapter(v.getContext(),
        android.R.layout.simple_spinner_dropdown_item,typeList);            
    groupSpinner.setAdapter(adapter);
    

提交回复
热议问题