我在这方面使用了建议,但我还有同样的问题。感谢我的朋友对使用 AsyncTask 的建议,但它对我不起作用。什么?这是我的代码:
DBAsyncTask dba = new DBAsyncTask(this, xmlCommand);
dba.inProcess = true;
dba.execute("");
while (dba.inProcess) {
try {
Thread.sleep(200);
println("wwwwait");
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public class DBAsyncTask extends AsyncTask<String, Void, String> {
public boolean inProcess;
public DBAsyncTask(ExirCommandRunner commandRunner,XmlNode xmlCommand) {
this.commandRunner = commandRunner;
this.xmlCommand = xmlCommand;
}
@Override
protected void onPostExecute(String result) {
ExirDebugger.println("onPostExecute");
}
@Override
protected void onPreExecute() {
showProgress();
}
@Override
protected String doInBackground(String... params) {
///my process here
closeProgress();
return null;
}
谁能帮我?