【发布时间】:2010-06-15 18:31:30
【问题描述】:
我的 ListActivity 有问题,我使用线程显示 ProgressDialog,其中获取所有已安装应用程序的列表。我把它变成了一个列表适配器,然后我想设置活动的列表适配器,但我不能从线程中做到这一点。
我收到以下错误:ERROR/AndroidRuntime(14429): android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
progressDialog = new ProgressDialog(this);
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressDialog.setMessage("Loading...");
progressDialog.show();
new Thread() {
public void run() {
showList(); // the method where i get all the apps and have the setListAdapter(); method
progressDialog.dismiss();
}
}.start();
如何获取它,以便可以在我的线程中使用 setListAdapter
【问题讨论】:
标签: android listactivity listadapter