I have a ListView. I want to dynamically change the contents of the listview.I used \"adapter.notifyDataSetChanged();\" to change the contents. I have also tried setting the ada
remove adapter.notifyDataSetChanged();
hope it works
If you use an ArrayAdapter
instead of a SimpleAdapter
you can call
ArrayAdapter.clear();
ArrayAdapter.notifyDataSetChanged();
To remove all the elements from the adapter.
Try This
final Handler handler = new Handler();
handler.postDelayed( new Runnable(){
@Override
public void run(){
//this line i have added in your code
registeredList.clear();
accessWebService();
handler.postDelayed(this, 10 * 1000);
Log.i("TAG", "notify");
}
}, 10 * 1000
);
Try this please:
Clear the arraylist/HashMap
Add new items
adapter.notifyDataSetChanged();
set adapter.