getView什么时候调用完成?

发布于 2024-11-10 14:23:47 字数 131 浏览 2 评论 0原文

我将列表视图项目位置保存在适配器方法“getView”中的集合中, 保存了当前显示项的位置,

但是调用setAdapter(myAdapter)后无法获取到设置的内容, 貌似是多线程的 如果可以的话,什么时候可以拿到设定的内容。

I save the listview items position in a set in adapter method "getView",
which saves the current displaying items position,

but I can't get the set content after invoking setAdapter(myAdapter),
It seems that it's multi-thread,
if that, when can i get the set content.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

開玄 2024-11-17 14:23:47

但是调用setAdapter(myAdapter)后却获取不到设置的内容,看来是多线程的,如果是的话,

那就不是“多线程”了。但是,当您调用 setAdapter() 时,Adapter 不会立即使用,任何超过 TextView 的内容都会在您调用 <代码>setText()。所有 GUI 事件均由基于工作队列的主应用程序线程处理 - 对 setAdapter() 的调用只有在您所在的任何代码块返回后才会生效。

but I can't get the set content after invoking setAdapter(myAdapter), It seems that it's multi-thread, if that,

It is not "multi-thread". However, the Adapter will not be immediately used when you call setAdapter(), any more than a TextView will be immediately updated when you call setText(). All GUI events are processed by the main application thread based off of a work queue -- calls to setAdapter() will not take effect until after whatever block of code you are in returns.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文