【问题标题】:Progress dialog spinning wheel stops while loading进度对话框旋转轮在加载时停止
【发布时间】:2013-08-21 06:36:20
【问题描述】:

我正在使用代码在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();
         }
    }

但是微调器只显示一段时间并且微调器冻结。我不知道我哪里出错了。我无法猜测进度是否完成。我已经搜索了许多相关的线程,但我还没有找到解决方案。

提前致谢。

【问题讨论】:

  • 使用DownloadManager 下载大尺寸数据(在您的情况下为230 mb)。检查developer.android.com/reference/android/app/…
  • 它会崩溃吗?还是只是慢跑并冻结?
  • 你在使用 Startsyntask.fetch() 吗?
  • 微调器被冻结。没有崩溃。我正在使用 Startsyntask.execute()

标签: android progressdialog


【解决方案1】:

它会冻结消失吗? 如果它冻结比我的猜测是你的主线程被卡住了。您可能有错误或下载有问题。

【讨论】:

  • 是的,实际上微调器会冻结。这是因为屏幕锁定吗?
  • 不,它不应该相关,但您可以确定通过禁用屏幕锁定来测试它,看看会发生什么。我认为这是一个循环,有些在您的代码中,但您应该对其进行测试。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-10-17
  • 1970-01-01
  • 2019-08-12
  • 2015-06-15
  • 2012-06-15
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多