【发布时间】: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()