我从这里使用部分列表视图http://lalit3686.blogspot.com/2012/05/sectionadapter.html遵循示例
但我该如何实施adapter.notifyDataSetChanged()
?
添加侦听器以更新列表视图数据:
mListView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Toast.makeText(SectionAdapterActivity.this, ""+position+"", Toast.LENGTH_SHORT).show();
test();
}
});
我只为更改/更新值添加新功能(仅限测试):
public void test()
{
hashMap.clear();
for (int i = 0; i < 3; i++) {
hashMap.put("Mail", String.valueOf(1100 + i), 1);
}
for (int j = 0; j < 4; j++) {
hashMap.put("Case", String.valueOf(2100 + j), 15);
}
for (int j = 0; j < 5; j++) {
hashMap.put("File", String.valueOf(10000 + j), 20);
}
mListView.invalidate();
mListView.invalidateViews();
adapter.notifyDataSetChanged();
Log.e("dada", hashMap.toString());
}}
好像不行,有大神帮忙吗?