是否有任何Android的后台工作!我用的进展this
Is there any background worker in android! I used progress dialog in this
但没有解决这个建议。我需要显示等待对话框,我的过程结束后,做其他处理。
but no resolve for this suggested. I need to show a wait dialog and after my process end, do other process.
我用的AsyncTask本主题中建议,但我的进度对话框不会立即显示尚未!!
I used AsyncTask suggested in this topic but my progress dialog not show immediately yet !!
试试这个:
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();
希望它帮助!
上一篇:JAVA EOFException类时的getInputStream从POSTEOFException、JAVA、getInputStream、ST
下一篇:Android的,解除绑定的服务和onServiceDisconnected问题绑定、问题、Android、onServiceDisconnected