在我的应用程序中,我正在使用 ExpandableListView
。我正在使用扩展 BaseExpandableListAdapter
的适配器。我想刷新 ExpandableListView
。
我的 ExpandableListView
由带有与数据库链接的删除按钮的项目组成。
如果我按下删除按钮,该项目将从数据库中永久删除。但是 listview
并没有同时刷新。如果我再次运行该 Activity ,它会刷新但不会同时运行。
我正在使用
mAdapter.notifyDataSetChanged();
但它并没有像我想要的那样工作。 为什么?
最佳答案
我刚刚在 BaseExpandableListAdapter 的以下重写方法上调用了 super,从那时起 notifyDataSetChanged() 开始工作。
@Override
public void registerDataSetObserver(DataSetObserver observer) {
super.registerDataSetObserver(observer);
}
关于ExpandableListView 的 android notifyDataSetChanged 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7817916/