List of usage examples for android.app AlertDialog isShowing
public boolean isShowing()
From source file:org.restcomm.app.qoslib.Utils.QosAPI.java
public static void showQoSPanel(final Activity activity) { try {/* w w w . ja v a2s. c o m*/ AlertDialog.Builder builder1 = new AlertDialog.Builder(activity); CharSequence qosInfo = getQosInfo(activity); builder1.setMessage(qosInfo); builder1.setTitle("QOS Info"); builder1.setCancelable(true); final AlertDialog alert11 = builder1.create(); alert11.show(); final Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { CharSequence qosInfo = getQosInfo(activity); if (alert11.isShowing()) { try { alert11.setMessage(qosInfo); handler.postDelayed(this, 1000); } catch (Exception e) { } } } }, 1000); } catch (Exception e) { LoggerUtil.logToFile(LoggerUtil.Level.ERROR, TAG, "CreateDevInfoAlertDialog", "exeption", e); } }
From source file:us.parshall.ezandroid.activity.EZActivity.java
protected void savePromptState() { AlertDialog[] alertDialogList = this.alertDialogList(); if (alertDialogList != null) { for (int i = 0; i < alertDialogList.length; i++) { AlertDialog dialog = alertDialogList[i]; if (dialog != null && dialog.isShowing()) { this.promptDialogList.push(i); }//w w w. j a v a2 s . c o m } } }
From source file:org.brandroid.openmanager.fragments.DialogHandler.java
/** * Show a warning that has a specific count down to auto-cancel. * @param context Context.// w w w .j a v a 2 s . c o m * @param msg Message String ID. * @param countSecs Length in seconds to show message before auto-cancelling. * @param onOK Callback for when "OK" is selected. * @return */ public static AlertDialog showWarning(final Context context, int msg, int countSecs, DialogInterface.OnClickListener onOK) { final Timer timer = new Timer("Count Down"); final AlertDialog dlg = new AlertDialog.Builder(context).setMessage(msg) .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); timer.cancel(); } }).setCancelable(true).setPositiveButton(android.R.string.ok, onOK).show(); final int[] cnt = new int[] { countSecs }; final Button btCancel = dlg.getButton(DialogInterface.BUTTON_NEGATIVE); TimerTask tt = new TimerTask() { @Override public void run() { if (dlg.isShowing()) { btCancel.post(new Runnable() { public void run() { btCancel.setText(context.getResources().getString(android.R.string.cancel) + " (" + cnt[0]-- + ")"); } }); } else cnt[0] = 0; if (cnt[0] <= 0) cancel(); } @Override public boolean cancel() { dlg.cancel(); return super.cancel(); } }; timer.scheduleAtFixedRate(tt, 0, 1000); return dlg; }