How to remove listview all items

后端 未结 11 2132
野的像风
野的像风 2020-12-15 15:36

In my app, if you click on a button then i want to remove all the listview items. Here, i am using the base adapter for adding the items to the list view.

How can i

11条回答
  •  北海茫月
    2020-12-15 16:20

    I just clean the arraylist , try values.clear();

    values = new ArrayList();
    values.clear();
    
    ArrayAdapter  adapter;
    adapter = new ArrayAdapter(this, R.layout.list,android.R.id.text1, values); 
    lista.setAdapter(adapter);
    

提交回复
热议问题