code: public <T> void execute(Command<T> cmd, int title, final CommandCallback<T> callback) {
          final ProgressDialog progressDialog = new ProgressDialog(this);
          progressDialog.setMessage(getString(title));
          progressDialog.setCancelable(false);
          progressDialog.setCanceledOnTouchOutside(false);
          progressDialog.show();
          cmd.start(new CommandCallback<T>() {
              @Override
              public void onResult(T res) {
                  dismissDialog(progressDialog);
                  callback.onResult(res);
              }
  
              @Override
              public void onError(Exception e) {
                  dismissDialog(progressDialog);
                  callback.onError(e);
              }
          });
      }
docs: Executions