Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android : clear listview in Listadapter [duplicate]

Possible Duplicate:
how to clear my listview in android

In android, i have used a listadapter, simple adapter and passed an array and i want to clear the listview contents? Instead of clearing , it is appending the records to my listview.

like image 817
AnnaSmith Avatar asked May 31 '12 09:05

AnnaSmith


1 Answers

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() from you Activity.

like image 184
Shaiful Avatar answered Oct 11 '22 12:10

Shaiful