我如何展示,然后取出一个机器人进度对话框 [英] How do I show and then remove an android progress dialog
本文介绍了我如何展示,然后取出一个机器人进度对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以得到一个进度条显示以下code
I can get a progress bar to appear with the following code
pd = ProgressDialog.show(myActivity.this, "", "Loading. Please wait...", true);
直线前进,但一旦我有code执行我希望它去了,但是当我运行解雇方法后,我从来没有看到该对话框中显示的。
straight forward, but once I have the code execute I want it to go away, but when I run the dismiss method after I never see the dialog box show at all.
继承人的code在上下文中被包裹在OnCreate中
Heres the code in context which is wrapped in oncreate
pd = ProgressDialog.show(myActivity.this, "", "Loading. Please wait...", true);
runCode();
setListAdapter(new CustomAdapter(myActivity.this));
pd.dismiss();
我想你可以显示/驳回活动进度对话框的任何地方,但我一定是错的。
I thought you can show/dismiss progress dialog's anywhere in the activity but I must be wrong.
推荐答案
这里是我开始工作的code
here is the code that I got to work
private class UpdateFeedTask extends AsyncTask<MyActivity, Void, Void> {
private ProgressDialog mDialog;
protected void onPreExecute() {
Log.d(TAG, " pre execute async");
mDialog = ProgressDialog.show(MyActivity.this,"Please wait...", "Retrieving data ...", true);
}
protected void onProgressUpdate(Void... progress) {
Log.d(TAG, " progress async");
}
@Override
protected Void doInBackground(MyActivity... params) {
// TODO Auto-generated method stub
return null;
}
protected void onPostExecute(Void result) {
Log.d(TAG, " post execute async");
mDialog.dismiss();
}
}
这篇关于我如何展示,然后取出一个机器人进度对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文