Android:在BaseAdapter中调用notifyDataSetChanged
我现在正在 Android 中调试一些开源电子邮件客户端,但我在消息状态(已读和未读)方面遇到问题。每当客户端收到新消息并查看邮件时,所有已读消息将再次变为未读状态。我有一个扩展 BaseAdapter 的自定义类。我的跟踪的一部分是我在 onResume 中调用了 notificationDataSetChanged。我的问题是,我怎么知道通过notifyDataSetChanged 确实改变了视图。我将日志放入bindView和getView中,以了解一旦我调用notifyDataSetChanged它是否真的通过,但日志没有显示。这是否意味着它没有调用适配器来设置新视图?
I'm debugging some open source email client in android right now but I have problem regarding the message status(read and unread). Whenever the client receives a new message and check mail, all the read messages become unread again. I has a customize class extending BaseAdapter. Part of my tracing is I invoked notifyDataSetChanged in onResume. My question is, how would I know that by notifyDataSetChanged really changes the view. I put logs in bindView and getView to know if it really passes once I call notifyDataSetChanged but the logs didn't show up. Does that mean it didn't call the adapter to set a new view?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试在 list 实例中调用
invalidate()
和invalidateViews()
。Try to call
invalidate()
andinvalidateViews()
in the instance of list.