简体   繁体   English

加载时进度对话框旋转轮停止

[英]Progress dialog spinning wheel stops while loading

I am using the code for showing progress bar with spinning wheel in asyn task as below 我正在使用代码在asyn任务中显示带有旋转轮的进度条,如下所示

class Startsyntask extends AsyncTask<Void, Void, Void> 
    {
         ProgressDialog dialog = new ProgressDialog(Myclass.this);
         protected void onPreExecute() 
         {
             dialog.setMessage("Please wait...");
             dialog.setIndeterminate(true);
             dialog.setCancelable(false);
             dialog.show();
         }

         @Override
         protected Void doInBackground(Void... arg0) 
         {

            // my code to download the contents from the Server ( approx 230 mb in size)

            return null;    
         }

         protected void onPostExecute(Void unused) 
         {      
             dialog.dismiss();
         }
    }

but the spinner shows only for some time and the spinner freezes . 但是微调框仅显示一段时间,并且微调框冻结。 I don't know where i am going wrong . 我不知道我要去哪里错了。 I could not guess whether the progress in complete or not . 我无法猜测进度是否已经完成。 I have searched for many related threads but i could not get the solution yet . 我已经搜索了许多相关的主题,但是还没有找到解决方案。

Thanks in advance . 提前致谢 。

Does it freeze of disappears? 它冻结消失了吗? If it freezes than my guess is that you main thread is stuck. 如果死机,我的猜测是您的主线程卡住了。 You probably have a bug or the download is doing something wrong. 您可能有错误,或者下载做错了什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM