alertDialog = buildAlertDialog(context); alertDialog.setOnDismissListener(this); alertDialog.setOnCancelListener(this); show();
public void showAlertDialog(final Activity activity, String title, String message, Boolean status) { AlertDialog alertDialog = new AlertDialog.Builder(activity).create(); alertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { activity.finish(); } }); alertDialog.show(); }
private void processOffline(String message){ if (isDestroyed() || isFinishing()) { return; } AlertDialog alertDialog = new AlertDialog.Builder(this) .setTitle(R.string.str_tips_title) .setMessage(message) .setPositiveButton(R.string.btn_sure, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.cancel(); } }) .create(); alertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialogInterface) { requiredLogin(); } }); alertDialog.show(); }
private void processOffline(String message){ if (isDestroyed() || isFinishing()) { return; } AlertDialog alertDialog = new AlertDialog.Builder(this) .setTitle(R.string.str_tips_title) .setMessage(message) .setPositiveButton(R.string.btn_sure, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.cancel(); } }) .create(); alertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialogInterface) { requiredLogin(); } }); alertDialog.show(); }
public static void getConfirmDialog(Context mContext,String title, String msg, String positiveBtnCaption, String negativeBtnCaption, boolean isCancelable, final AlertMagnatic target) { AlertDialog.Builder builder = new AlertDialog.Builder(mContext); int imageResource = android.R.drawable.ic_dialog_alert; Drawable image = mContext.getResources().getDrawable(imageResource); builder.setTitle(title).setMessage(msg).setIcon(image).setCancelable(false).setPositiveButton(positiveBtnCaption, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { target.PositiveMethod(dialog, id); } }).setNegativeButton(negativeBtnCaption, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { target.NegativeMethod(dialog, id); } }); AlertDialog alert = builder.create(); alert.setCancelable(isCancelable); alert.show(); if (isCancelable) { alert.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { target.NegativeMethod(null, 0); } }); } }
public static void getConfirmDialog(Context mContext,String title, String msg, String positiveBtnCaption, String negativeBtnCaption, boolean isCancelable, final AlertMagnatic target) { AlertDialog.Builder builder = new AlertDialog.Builder(mContext); int imageResource = android.R.drawable.ic_dialog_alert; Drawable image = mContext.getResources().getDrawable(imageResource); builder.setTitle(title).setMessage(msg).setIcon(image).setCancelable(false).setPositiveButton(positiveBtnCaption, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { target.PositiveMethod(dialog, id); } }).setNegativeButton(negativeBtnCaption, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { target.NegativeMethod(dialog, id); } }); AlertDialog alert = builder.create(); alert.setCancelable(isCancelable); alert.show(); if (isCancelable) { alert.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { target.NegativeMethod(null, 0); } }); } }
alertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) {
@Override public void forceQuitRoom(String strMessage) { if (isDestroyed() || isFinishing()) { return; } ILiveRoomManager.getInstance().onPause(); AlertDialog alertDialog = new AlertDialog.Builder(this) .setTitle(R.string.str_tips_title) .setMessage(strMessage) .setPositiveButton(R.string.btn_sure, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.cancel(); } }) .create(); alertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialogInterface) { callExitRoom(); } }); alertDialog.show(); }
private void promptPrio(final Activity activity) { final AlertDialog alertDialog; alertDialog = new AlertDialog.Builder(activity).create(); alertDialog.setTitle("Enable High Priority!"); TextView textView = new TextView(activity); textView.setVisibility(View.VISIBLE); textView.setPadding(20, 20, 20, 20); textView.setText("Warning! High Priority might increase emulation speed but " + "will slow your phone down!"); alertDialog.setView(textView); alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { LimboSettingsManager.setPrio(activity, true); } }); alertDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { mPrio.setChecked(false); return; } }); alertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { mPrio.setChecked(false); } }); alertDialog.show(); }
alert.show(); if (isCancelable) { alert.setOnCancelListener(new OnCancelListener() {
AsyncTask<Void,Void,Void> task = new AsyncTask<Void, Void, Void>() { private AlertDialog dialog; @Override protected void onPreExecute() { super.onPreExecute(); dialog= new AlertDialog.Builder(MainActivity.this); dialog.setTitle("Detecting....."); dialog.setMessage("Please Wait"); dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialogInterface) { cancel(true); } }); dialog.show(); } @Override protected Void doInBackground(Void... voids) { timeConsumingDetectMethod(); return null; } @Override protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); dialog.dismiss(); } }.execute();
alertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) {
/** * Shows an error message. * * @param context * {@link Context} * @param msg * the message. * @param listener * will be called after the user cancelled the dialog. */ public static void showError(Context context, CharSequence msg, DialogInterface.OnCancelListener listener) { AlertDialog dlg = newDlg(context); dlg.setIcon(android.R.drawable.ic_dialog_alert); dlg.setTitle(R.string.afc_title_error); dlg.setMessage(msg); dlg.setOnCancelListener(listener); dlg.show(); }// showError()
alertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) {
/** * Shows a confirmation dialog. * * @param context * {@link Context} * @param msg * the message. * @param onYes * will be called if the user selects positive answer (a * <i>Yes</i> or <i>OK</i>). * @param onNo * will be called after the user cancelled the dialog. */ public static void confirmYesno(Context context, CharSequence msg, DialogInterface.OnClickListener onYes, DialogInterface.OnCancelListener onNo) { AlertDialog dlg = newDlg(context); dlg.setIcon(android.R.drawable.ic_dialog_alert); dlg.setTitle(R.string.afc_title_confirmation); dlg.setMessage(msg); dlg.setButton(DialogInterface.BUTTON_POSITIVE, context.getString(android.R.string.yes), onYes); dlg.setOnCancelListener(onNo); dlg.show(); }
@Override protected void onProgressUpdate(final String... values) { final int length = LengthUtils.length(values); if (length == 0) { return; } final String last = values[length - 1]; if (progressDialog == null || !progressDialog.isShowing()) { progressDialog = new AlertDialog.Builder(context).setMessage(last).show(); if (cancellable) { progressDialog.setCancelable(true); progressDialog.setCanceledOnTouchOutside(true); progressDialog.setOnCancelListener(this); } else { progressDialog.setCancelable(false); progressDialog.setCanceledOnTouchOutside(false); } } else { progressDialog.setMessage(last); } } }
@Override protected void onProgressUpdate(final String... values) { final int length = LengthUtils.length(values); if (length == 0) { return; } final String last = values[length - 1]; try { if (progressDialog == null || !progressDialog.isShowing()) { progressDialog = ProgressDialog.show(context, "", last, true); progressDialog.setCancelable(true); progressDialog.setCanceledOnTouchOutside(true); progressDialog.setOnCancelListener(this); } else { progressDialog.setMessage(last); } } catch (final Throwable th) { } } }
Dialog createDialog() { mAdapter = new ArrayAdapter<>(CustomizeLaunchersActivity.this, R.layout.add_list_item); mAdapter.add(getString(R.string.custom_icon_select_picture)); mAdapter.add(getString(R.string.custom_icon_icon_packs)); if (SpecialIconStore.hasBitmap(CustomizeLaunchersActivity.this, mAppClicked.getComponentName(), SpecialIconStore.IconType.Custom)) { mAdapter.add(getString(R.string.custom_icon_clear_icon)); } final AlertDialog.Builder builder = new AlertDialog.Builder(CustomizeLaunchersActivity.this); builder.setTitle(R.string.custom_icon_select_icon_type); builder.setAdapter(mAdapter, this); //builder.setInverseBackgroundForced(false); AlertDialog dialog = builder.create(); dialog.setOnCancelListener(this); dialog.setOnDismissListener(this); dialog.setOnShowListener(this); return dialog; } public void onCancel(DialogInterface dialog) {
@Override public void onBackPressed() { final AlertDialog alert = new AlertDialog.Builder(new ContextThemeWrapper(contextForAlert,R.style.CustomAlertDialogue)).create(); alert.setTitle(title); alert.setMessage(message); alert.setIcon(R.drawable.warning_icon); alert.setCancelable(false); alert.setCanceledOnTouchOutside(false); alert.setButton(DialogInterface.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); alert.setButton(DialogInterface.BUTTON_NEGATIVE, "Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { alert.dismiss(); } }); alert.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { } }); alert.show(); }
mSelectTime.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialogInterface) {