调用notifyDataSetChanged不会触发SimpleCursorAdapter的onContentChanged事件
我有这样的场景
onResume 活动:
@Override
protected void onResume() {
if (adapter1!=null) adapter1.notifyDataSetChanged();
if (adapter2!=null) adapter2.notifyDataSetChanged();
if (adapter3!=null) adapter3.notifyDataSetChanged();
super.onResume();
}
适配器已定义为:
public class ListCursorAdapter extends SimpleCursorAdapter {
Cursor c;
/* (non-Javadoc)
* @see android.widget.CursorAdapter#onContentChanged()
*/
@Override
protected void onContentChanged() {
// this is not called
if (c!=null) c.requery();
super.onContentChanged();
}
}
尽管发出了 onResume 和对适配器的调用,但 onContentChanged 事件未触发。怎么了?
I have this scenario
onResume of an activity:
@Override
protected void onResume() {
if (adapter1!=null) adapter1.notifyDataSetChanged();
if (adapter2!=null) adapter2.notifyDataSetChanged();
if (adapter3!=null) adapter3.notifyDataSetChanged();
super.onResume();
}
Adapter has been defined as:
public class ListCursorAdapter extends SimpleCursorAdapter {
Cursor c;
/* (non-Javadoc)
* @see android.widget.CursorAdapter#onContentChanged()
*/
@Override
protected void onContentChanged() {
// this is not called
if (c!=null) c.requery();
super.onContentChanged();
}
}
And the onContentChanged event is not fired, although the onResume and the call to the adapter is issued. What is wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当光标上的 ContentObserver 收到更改通知。
The onContentChanged method will be called when the ContentObserver on the cursor receives a change notification.