本文介绍了android:显示进度对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我已经在stackoverflow上查看了Android API和其他帖子,但无法弄清楚这一点。I have looked at the Android API and other posts here on stackoverflow, but have not been able to figure this out.我的应用程序将文件下载到SD卡。我想在文件下载时弹出一个加载...对话框,然后在下载完成后消失。这是我想到的使用android API:My app downloads files to the sd card. I would like to pop a "loading..." dialog while the file is downloading and then have it disappear when the download is finished. This is what i came up with using the android API:ProgressDialog pd = ProgressDialog.show(this,"","Loading. Please wait...",true);//download filepd.cancel();但是对话框实际上并不显示。当我调试它,它声称它显示,但显然不在屏幕上。however the dialog doesn't actually show. when i debug it, it claims that it is showing, but it is obviously not on the screen.我可以做什么?推荐答案您必须将下载代码运行到单独的线程中。简单的方法是使用 AsyncTaskYou have to run the download code into a separated Thread. The easy way is to use AsyncTask另请参阅这篇文章如何使用它Look also this article on how to use it 这篇关于android:显示进度对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
06-03 14:44
查看更多