刷新Android视图

Sam*_*562 8 java android

我想刷新listview.当我从不同的类中获取值时,我希望它将其更新为列表视图.我正在创建一个用于刷新列表的线程,但我得到一个异常:

Only the original thread that created a thread a view hierarchy can touch its views

如何进行?

Pra*_*ast 17

而不是尝试刷新视图以更新列表,只需获取Adapter对象并调用notifyDataSetChanged()API.