Clear Android ListView

馋奶兔 提交于 2019-12-02 02:51:38

Try this please:

Clear the arraylist/HashMap

Add new items

adapter.notifyDataSetChanged();

set adapter.

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

                        ); 

remove adapter.notifyDataSetChanged(); hope it works

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!