Skip to content Skip to sidebar Skip to footer

How To Invalidate Listview For New Data When Using Listadapter

I am making use of a default listview in a fragment to show data that is being called from a URL. There is a SwipeRefreshLayout where the ListView is contained. However when I refr

Solution 1:

the important is : do you clear ArrayList> newsItemList when you get new data? if u do just repeat:

      ListAdapter adapter = new SimpleAdapter(getActivity(), newsItemList, R.layout.list_item, newString[]{TAG_TITLE, TAG_DATE, TAG_OWNER}, newint[]{R.id.news_title, R.id.news_date, R.id.news_owner});       
 lvGeneralNews.setAdapter(adapter); 

Solution 2:

Try using adapter.clear(); put it in the method that is executed when you perform a refresh!

Post a Comment for "How To Invalidate Listview For New Data When Using Listadapter"