HardBirch

Listview & BaseAdapter refresh list with function invalidate()

时间:13-02-19 栏目:android学习笔记 作者:魔豆先生 评论:0 点击: 6,809 次

I have Vector of elements that i set into BaseAdapter subclass and this adapter works with this elements

I need to refresh my list, so i set new vector to my adapter class and call invalidate()  method but it doesent work.  How can fix it?

 

Here is code of my refreshing method

public void updateGroups(Page page) {

this.page = page;
listView = (ListView)findViewById(R.id.groups_list);
SelectGroupsListAdapter adapter =(SelectGroupsListAdapter)listView.getAdapter();
adapter.setGroups(page.getItems());
listView.invalidate();

}

 

Solution:

public void updateGroups(Page page) {

this.page = page;
listView = (ListView)findViewById(R.id.groups_list);
SelectGroupsListAdapter adapter =(SelectGroupsListAdapter)listView.getAdapter();
adapter.setGroups(page.getItems());
listView.invalidate();
adapter.notifyDataSetChanged();

}

声明: 本文由( 魔豆先生 )原创编译,转载请保留链接: Listview & BaseAdapter refresh list with function invalidate()

Listview & BaseAdapter refresh list with function invalidate():等您坐沙发呢!

发表评论


QQ群互动

Linux系统与内核学习群:194051772

WP建站技术学习交流群:194062106

魔豆之路QR

魔豆的Linux内核之路

魔豆的Linux内核之路

优秀工程师当看优秀书籍

优秀程序员,要看优秀书!

赞助商广告

友荐云推荐