刷新视图的Andr​​oid视图、Andr、oid

2023-09-06 09:26:37 作者:喜欢何必说成爱

我想刷新列表视图。当我收到来自不同类的值,我希望它更新到列表视图。我创建一个线程刷新列表,但我得到一个异常:

I want to refresh a listview. When I am getting a value from different class I want it to update that to list view. I am creating a thread for refreshing the list but I am getting an exception:

只有创建一个线程原始线程一个视图层次可以触摸自己的看法

如何进行呢?

推荐答案

而不是试图刷新视图以更新列表只是把适配器对象和调用notifyDataSetChanged()API。

Instead of trying to refresh the view to update the list just take the Adapter object and call the notifyDataSetChanged() API.