我试图从this MultiChoiceAdapter库实现this example库。如何从MultiChoiceAdapter库更新ListView?
它看起来非常完美。我唯一改变的是ListView
高度,在ListView
之后加了Button
。
现在,我与Button
想法是更新适配器。为此,我创建了以下方法:
private void updateData(Bundle savedInstanceState){
List<String> items = Arrays.asList("Item1", "Item2", "Item3", "Item4");
adapter = null;
adapter = new ComplexItemLayoutAdapter(savedInstanceState, items);
adapter.notifyDataSetChanged();
}
最后,它没有工作。我试过以下this答案,但它不起作用,因为这个例子没有扩展ArrayAdapter。
如何更新这种适配器?
非常感谢。
你为什么要设置适配器为null,并作出新的实例? – Hellboy
因为我不确定如何更新它。我应该如何继续? –