从ArrayAdapter每毫秒更新单行Android中的ListView [英] Updating a single row in Android ListView every millisecond from ArrayAdapter

查看:235
本文介绍了从ArrayAdapter每毫秒更新单行Android中的ListView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ListView和ArrayAdapter设置就可以了。我的ListView单列包含TextView的开始按钮。当点击按钮TextView的文本将每毫秒改变。我已经定义定时器它,但是当我改变TextView的文本不会出现在我的视野。它只有当我打电话notifyDataSetChanged变化。但是,在这种情况下,调用notifyDataSetChanged每毫秒,我的ListView中坠毁。我怎样才能解决这个问题?另外我想说的是我实现ArrayAdapter与ViewHolder模式和overrided所有必要的方法。

I have a ListView and ArrayAdapter set on it. My ListView single row contains TextView and start Button. When click on button the TextView text will be changed every millisecond. I have defined timer for it but when I change TextView text it doesn't appears on my view. It changes only when I call notifyDataSetChanged. But in this case calling notifyDataSetChanged every millisecond, my ListView is crashed. How can I solve this problem? In addition to I want to say that I implemented ArrayAdapter with ViewHolder pattern and overrided all necessary methods.

推荐答案

你应该使用RecyclerView它是提供一个有限的元素融入到一个大的数据集的灵活的看法。所以你可以用它来控制多少物品应在特定的条件下加载。你可以阅读有关RecyclerView 这里

you should use RecyclerView it is a A flexible view for providing a limited elements into a large data set. so you can use it to control how many items should Be loaded on particular conditions. you can read about the RecyclerView here

这篇关于从ArrayAdapter每毫秒更新单行Android中的ListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆