here is my code
public ProgressDialog loadingdialog; public void ShowManager() { //do something } public void startScan() { loadingdialog = ProgressDialog.show(WifiManagementActivity.this, "","Scanning Please Wait",true); new Thread() { public void run() { try { sleep(4000); ShowManager(); } catch(Exception e) { Log.e("threadmessage",e.getMessage()); } loadingdialog.dismiss(); } }.start(); } startScan();
The main function of showdialog show, but on the line where ShowManager () is called, is getting an error,
01-07 23:11:36.081: ERROR/threadmessage(576): Only the original thread that created a view hierarchy can touch its views.
EDIT:
ShowManager () is a function that modifies the elements of a view. briefly something like
public void ShowManager() { TextView mainText = (TextView) findViewById(R.id.wifiText); mainText.setText("editted"); }
source share