Possible duplicate:how to clear the list in android
In android, I used a list, a simple adapter, and passed an array, and I want to clear the contents of the list. Instead of clearing, this is adding entries to my list.
Grab my custom adapter from here. Testadapter
Now add a method like this.
public void clearAdapter() { deviceNames.clear(); selected.clear(); notifyDataSetChanged(); }
Now call youListAdapter.clearAdapter()out your activity.
youListAdapter.clearAdapter()
Just write listView.setAdapter (null)
notifydataSetInValidated() , , . null: l.setAdapter(null);
notifydataSetInValidated()
l.setAdapter(null);