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
For me worked this way:
private ListView yourListViewName;
private List yourListName;
...
yourListName = new ArrayList<>();
yourAdapterName = new yourAdapterName(this, R.layout.your_layout_name, yourListName);
...
if (yourAdapterName.getCount() > 0) {
yourAdapterName.clear();
yourAdapterName.notifyDataSetChanged();
}
yourAdapterName.add(new YourClassName(yourParameter1, yourParameter2, ...));
yourListViewName.setAdapter(yourAdapterName);