0

I have a problem with a progress dialog that does not appear, I don't know what is wrong with my code.

I have a listener with EventBus that open, update or close the progress dialog. I can see createDialog(), updateProgress() and closeDialog() are being called with android debugger but the progress dialog doesn't appear.

Please help

private void createDialog(){
  progressDialog = new ProgressDialog(this);
  //progressDialog.vis

  progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
  progressDialog.setCancelable(false);
  progressDialog.setMessage(getString(R.string.pager_wait_record));
  progressDialog.show();
}

private void updateProgress(int total, int count){
  progressDialog.setMax(total);
  progressDialog.setProgress(count); 
}

private void closeDialog(){
  if (progressDialog.isShowing()) {
    progressDialog.dismiss();
  }
}

@Subscribe(threadMode = ThreadMode.MAIN)
public void onMessageProgress(EBProgress event) {
  Log.d(">>>>>>>", "progress");
  switch (event.option){
    case SHOW_DIALOG:
      Log.d(">>>>>>>", "show dialog");
      createDialog();
      break;
    case CLOSE_DIALOG:
      Log.d(">>>>>>>", "close dialog");
      closeDialog();
      break;
    case UPDATE_PROGRESS_DIALOG:
      Log.d(">>>>>>>", "update dialog");
      updateProgress(event.total, event.count);
      break;
    default:
      break;
  }
}
ישו אוהב אותך
  • 28,609
  • 11
  • 78
  • 96

0 Answers0