android.app.ProgressDialog.setOnCancelListener()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(153)

本文整理了Java中android.app.ProgressDialog.setOnCancelListener()方法的一些代码示例,展示了ProgressDialog.setOnCancelListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ProgressDialog.setOnCancelListener()方法的具体详情如下:
包路径:android.app.ProgressDialog
类名称:ProgressDialog
方法名:setOnCancelListener

ProgressDialog.setOnCancelListener介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

class MyAsyncTask extends AsyncTask<String, String, Void> {
 private ProgressDialog progressDialog = new ProgressDialog(MainActivity.this);
 InputStream inputStream = null;
 String result = ""; 
 protected void onPreExecute() {
   progressDialog.setMessage("Downloading your data...");
   progressDialog.show();
   progressDialog.setOnCancelListener(new OnCancelListener() {
     public void onCancel(DialogInterface arg0) {
       MyAsyncTask.this.cancel(true);
     }
   });
 }

代码示例来源:origin: stackoverflow.com

progressDialog.setOnCancelListener(new OnCancelListener() {
  @Override
  public void onCancel(DialogInterface dialog) {

代码示例来源:origin: ankidroid/Anki-Android

@SuppressWarnings("deprecation") // ProgressDialog change tracked in github as #5020
private void showProgressDialog(String message) {
  dismissCarefullyProgressDialog();
  progressDialog = android.app.ProgressDialog.show(this, gtxt(R.string.multimedia_editor_progress_wait_title), message, true,
      false);
  progressDialog.setCancelable(true);
  progressDialog.setOnCancelListener(this);
}

代码示例来源:origin: WVector/AppUpdate

public static void showProgressDialog(final Activity activity, String msg, boolean cancelable, DialogInterface.OnCancelListener listener) {
  if (activity == null || activity.isFinishing()) {
    return;
  }
  if (sCircleProgressDialog == null) {
    sCircleProgressDialog = new ProgressDialog(activity);
    sCircleProgressDialog.setMessage(msg);
    sCircleProgressDialog.setOwnerActivity(activity);
    sCircleProgressDialog.setOnCancelListener(listener);
    sCircleProgressDialog.setCancelable(cancelable);
  } else {
    if (activity.equals(sCircleProgressDialog.getOwnerActivity())) {
      sCircleProgressDialog.setMessage(msg);
      sCircleProgressDialog.setCancelable(cancelable);
      sCircleProgressDialog.setOnCancelListener(listener);
    } else {
      //不相等,所以取消任何ProgressDialog
      cancelProgressDialog();
      sCircleProgressDialog = new ProgressDialog(activity);
      sCircleProgressDialog.setMessage(msg);
      sCircleProgressDialog.setCancelable(cancelable);
      sCircleProgressDialog.setOwnerActivity(activity);
      sCircleProgressDialog.setOnCancelListener(listener);
    }
  }
  if (!sCircleProgressDialog.isShowing()) {
    sCircleProgressDialog.show();
  }
}

代码示例来源:origin: facebook/facebook-android-sdk

spinner.setOnCancelListener(new OnCancelListener() {
  @Override
  public void onCancel(DialogInterface dialogInterface) {

代码示例来源:origin: ankidroid/Anki-Android

@SuppressWarnings("deprecation") // ProgressDialog change tracked in github as #5020
protected void translate() {
  if(!Connection.isOnline()) {
    showToast(gtxt(R.string.network_no_connection));
    return;
  }
  progressDialog = android.app.ProgressDialog.show(this, getText(R.string.multimedia_editor_progress_wait_title),
      getText(R.string.multimedia_editor_trans_translating_online), true, false);
  progressDialog.setCancelable(true);
  progressDialog.setOnCancelListener(this);
  mWebServiceAddress = computeAddress();
  try {
    mTranslationLoadPost = new BackgroundPost();
    mTranslationLoadPost.execute();
  } catch (Exception e) {
    progressDialog.dismiss();
    showToast(getText(R.string.multimedia_editor_something_wrong));
  }
}

代码示例来源:origin: stackoverflow.com

progDailog.setOnCancelListener(new OnCancelListener() {
  @Override
  public void onCancel(DialogInterface dialog) {

代码示例来源:origin: stackoverflow.com

ProgressDialog progressDialog = ProgressDialog.show(ActivityName.this,
     "Title",
     "Message");
 progressDialog.setCancelable(true);
 progressDialog.setOnCancelListener(new OnCancelListener() {
   @Override
   public void onCancel(DialogInterface dialog) {
     // TODO Auto-generated method stub
     // Do something...
   }
 });

代码示例来源:origin: pili-engineering/PLDroidShortVideo

mProcessingDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
  @Override
  public void onCancel(DialogInterface dialogInterface) {

代码示例来源:origin: stackoverflow.com

mPDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
  @Override
  public void onCancel(DialogInterface dialog) {

代码示例来源:origin: chat-sdk/chat-sdk-android

dialog.setOnCancelListener(dialog1 -> disposableList.dispose());

代码示例来源:origin: stackoverflow.com

myProgressDialog.setOnCancelListener(new OnCancelListener() {

代码示例来源:origin: multidots/android-app-common-tasks

- ((int) (dimensions[0] * scale + 0.5f)), display.getHeight() - ((int) (dimensions[1] * scale + 0.5f))));
mSpinner.setOnCancelListener(new OnCancelListener() {
  @Override
  public void onCancel(DialogInterface dialogInterface) {

代码示例来源:origin: multidots/android-app-common-tasks

- ((int) (dimensions[0] * scale + 0.5f)), display.getHeight() - ((int) (dimensions[1] * scale + 0.5f))));
mSpinner.setOnCancelListener(new OnCancelListener() {
  @Override
  public void onCancel(DialogInterface dialogInterface) {

代码示例来源:origin: huntermr/FastAndroid

@Override
public void setProgressCancelListener(DialogInterface.OnCancelListener onCancelListener) {
  if (mProgressDialog != null) {
    mProgressDialog.setOnCancelListener(onCancelListener);
  }
}

代码示例来源:origin: stackoverflow.com

ProgressDialog progressDialog = ProgressDialog.show(ActivityName.this, 
                 "Title","Message");
 progressDialog.setCancelable(true);
 progressDialog.setOnCancelListener(new OnCancelListener() {
   @Override
   public void onCancel(DialogInterface dialog) {
     // TODO Auto-generated method stub
     // Do something...
   }
 });

代码示例来源:origin: stackoverflow.com

ProgressDialog p; 
p.setCancelable(true);
p.setOnCancelListener(new OnCancelListener() {          
@Override
public void onCancel(DialogInterface dialog) {
  //stop thread execution     
}
});

代码示例来源:origin: apsun/NekoSMS

@Override
protected void onPreExecute() {
  ProgressDialog dialog = new ProgressDialog(mContext);
  dialog.setMessage(mContext.getString(mProgressMessageId));
  dialog.setIndeterminate(true);
  dialog.setCancelable(mCancelable);
  if (mCancelable) {
    dialog.setOnCancelListener(this);
  }
  dialog.show();
  mDialog = dialog;
}

代码示例来源:origin: stackoverflow.com

public static ProgressDialog show(Context context, CharSequence title,
    CharSequence message, boolean indeterminate,
    boolean cancelable, OnCancelListener cancelListener) {
  ProgressDialog dialog = new ProgressDialog(context);
  dialog.setTitle(title);
  dialog.setMessage(message);
  dialog.setIndeterminate(indeterminate);
  dialog.setCancelable(cancelable);
  dialog.setOnCancelListener(cancelListener);
  dialog.show();
  return dialog;
}

代码示例来源:origin: stackoverflow.com

public static ProgressDialog show(Context context, CharSequence title,
    CharSequence message, boolean indeterminate,
    boolean cancelable, OnCancelListener cancelListener) {
  ProgressDialog dialog = new ProgressDialog(context);
  dialog.setTitle(title);
  dialog.setMessage(message);
  dialog.setIndeterminate(indeterminate);
  dialog.setCancelable(cancelable);
  dialog.setOnCancelListener(cancelListener);
  dialog.show();
  return dialog;
}

相关文章