更新android中的相对时间

发布于 2024-09-08 17:27:07 字数 162 浏览 5 评论 0原文

我正在开发 Twitter 客户端应用程序。与其他 Twitter 客户端一样,我想显示推文相对于当前时间的相对时间。我正在使用列表视图和简单适配器,该适配器绑定到存储推文信息的数组列表。如果我计算相对时间并存储一个字符串,我将只存储永远不会更新的静态数据。我应该如何更新这些数据?有什么办法可以做到这一点吗?

I am developing a Twitter client application. As with other twitter clients, I would like to display the relative time of tweet with respect to the current time. I am using a list view and a Simple adapter that binds to an arraylist which stores the tweet information. If I calculate the relative time and store a string, I will be just storing static data which will never get updated. How should I update this data?? Is there any way to do this?

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

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

发布评论

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

评论(1

几味少女 2024-09-15 17:27:07

您必须在适配器上每隔 X 秒重新计算一次。如果您更新适配器,列表视图也会自行更新。

You will have to incorporate on your adapter a recalculation every X seconds. And if you update your adapter, the listview will update itself too.

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