android中有没有后台工作者!我在此使用了进度对话框
但没有解决这个建议。我需要显示一个等待对话框,在我的流程结束后,执行其他流程。
我使用了本主题中建议的 AsyncTask,但我的进度对话框尚未立即显示!
android中有没有后台工作者!我在此使用了进度对话框
但没有解决这个建议。我需要显示一个等待对话框,在我的流程结束后,执行其他流程。
我使用了本主题中建议的 AsyncTask,但我的进度对话框尚未立即显示!
尝试这个:
class myAsyncTask extends AsyncTask<Void, Void, Void> {
Context context;
myAsyncTask(Context context) {
this.context=context;
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
//Do stuff that you want after completion of background task and also dismiss progress here.
}
@Override
protected void onPreExecute() {
super.onPreExecute();
//create and show progress dialog here
}
@Override
protected Void doInBackground(Void… arg0) {
//background task here
return null;
}
}
并像这样执行:
myAsyncTask myWebFetch = new myAsyncTask();
myWebFetch.execute();
希望能帮助到你!!