How to update a spinner dynamically?

后端 未结 10 1181
北荒
北荒 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:02

    Apparently after you do typeList = dbAdapter.getList(), the variable typeList points to a different List rather than the one you fed to the adapter originally and the adapter would be somewhat confused.

    So you should use the following code:

    typeList.clear();
    typeList.addAll(dbAdapter.getList());
    

提交回复
热议问题