進行中のダイアログで進行状況の更新を確認できません。
活動クラスでは:
void retrieveImages()
{
mImageUriList = new ArrayList<String>();
mImageUriList = Utils.fetchImages(this);
mProgressDialog = new ProgressDialog(this);
// progress dialog here is class level activity member
mProgressDialog.show();
mProgressDialog.setIndeterminate(false);
mProgressDialog.setMessage("Processing Images..");
mProgressDialog.setMax(100);
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
mProgressDialog.setCanceledOnTouchOutside(false);
new GetImageAsyncTask(this, mImageUriList,mProgressDialog).execute();
// passing progress dialog to async task
}
AsyncTask で
@Override
protected Void doInBackground(Void... params)
{
int progress_status;
float count=imageUriList.size();
float increment=0;
float p=(increment/count)*100;
for(int i=0;i<count;i++)
{
increment++;
//do some operation
p=(increment/count)*100;
progress_status=Math.round(p);
publishProgress(progress_status);
Log.i(TAG, "progress value-"+progress_status);
}
return null;
}
@Override
protected void onProgressUpdate(Integer... values)
{
//super.onProgressUpdate(values);
progressDialog.setProgress(values[0]);
}
スピナーと「画像を処理しています..」というメッセージしか表示されず、進行状況バー/更新は表示されません
私は ActionBarSherLock を使用しています。ここでもこのソリューションを試しましたが、これも機能していないようです。また、アクションバーに進行状況スピナーが表示されるだけです。アクションバーではなく、ダイアログに進行状況を表示したい。