如何显示然后删除 Android 进度对话框
我可以直接使用以下代码来显示进度条
pd = ProgressDialog.show(myActivity.this, "", "Loading. Please wait...", true);
,但是一旦执行代码,我希望它消失,但是当我在运行解雇方法后根本看不到对话框显示。
这是包含在 oncreate 中的上下文中的代码,
pd = ProgressDialog.show(myActivity.this, "", "Loading. Please wait...", true);
runCode();
setListAdapter(new CustomAdapter(myActivity.this));
pd.dismiss();
我认为您可以在活动中的任何位置显示/关闭进度对话框,但我一定是错的。
I can get a progress bar to appear with the following code
pd = ProgressDialog.show(myActivity.this, "", "Loading. Please wait...", true);
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.
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是我要工作的代码
here is the code that I got to work
参考我的示例代码sinnpet,希望这可以帮助你
refer the sample code sinnpet of mine,hope this may help you
要删除进度条,
请隐藏 xml 中的进度条并将其显示为
To remove a progressBar
hide the progressbar in xml and show it like