Why can't one add/remove items from an ArrayAdapter?

前端 未结 7 1227
一整个雨季
一整个雨季 2020-11-29 07:26

I am using an ArrayAdapter to populate the items to list in a android.widget.Spinner. That works all fine.

But now I wa

7条回答
  •  攒了一身酷
    2020-11-29 07:43

    You can try like this:

    new ArrayList<>(Arrays.asList(recentlyClient))
    

    Example code how to implement:

    String[] recentlyClient;
    
    ArrayAdapter recenAdapter = new ArrayAdapter(MainActivity.this,android.R.layout.simple_list_item_1,new ArrayList<>(Arrays.asList(recentlyClient)));
    
    

提交回复
热议问题