Only the original thread that created a view hierarchy can touch its views
近来又在开发一款新的android平台上的应用。界面处理的工作比较繁琐,故欲将界面的操作放到一个线程里。可是总是报异常。难道android对界面的操作只能放到主线程?
异常原文:Only the original thread that created a view hierarchy can touch its views
progressDialog = ProgressDialog.show(GPowerActivity.this,"处理中","正在处理方案"+selectProfile.getName(),true);
Toast.makeText(GPowerActivity.this, "开启" Toast.LENGTH_LONG).show();
class ThreadApplyProfile extends Thread
{
private Profile selectProfile;
public ThreadApplyProfile(Profile selectProfile )
{
this.selectProfile = selectProfile;
}
public void run()
{
try
{
//界面操作函数
changeUI();
}
catch (Exception e)
{
}
progressDialog.dismiss();
}
}
这个问题尚未确认!下班之后再搞定它!


















it’s very good!