List of usage examples for android.content DialogInterface cancel
void cancel();
From source file:Main.java
public static void showAlertDialog(final Activity activity, final String titel, final String text) { if (!activity.isFinishing()) { activity.runOnUiThread(new Runnable() { public void run() { aDialogBuilder = new AlertDialog.Builder(activity); aDialogBuilder.setMessage(text); aDialogBuilder.setTitle(titel); aDialogBuilder.setCancelable(false); aDialogBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); }//w w w . j a va2 s . c o m }); aDialog = aDialogBuilder.create(); aDialog.show(); } }); } }
From source file:ca.frozen.curlingtv.App.java
public static void error(Context context, String message) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setMessage(message);//from w ww.ja va 2 s .c o m builder.setCancelable(true); builder.setNeutralButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); builder.show(); }
From source file:Main.java
public static AlertDialog createAlert(String title, String message, Context context) { // Make an AlertDialog builder AlertDialog.Builder builder1 = new AlertDialog.Builder(context); //TODO: extract string // Set title//w ww . j a v a 2 s. c o m builder1.setTitle(title); // Set message builder1.setMessage(message); // Set cancelable builder1.setCancelable(true); // Build a new neutral button dialog builder1.setNeutralButton(android.R.string.ok, new DialogInterface.OnClickListener() { // On click of the neutral button public void onClick(DialogInterface dialog, int id) { // Cancel the dialog dialog.cancel(); } }); // Create the AlertDialog AlertDialog alert11 = builder1.create(); return alert11; }
From source file:br.fucapi.fapeam.monitori.eula.Eula.java
public static void show(final FragmentActivity activity, int title, int closeLabel) { final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(title);/* w w w . j a v a2 s . c o m*/ builder.setCancelable(true); builder.setNeutralButton(closeLabel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); builder.setMessage(readEula(activity)); builder.create().show(); }
From source file:com.evozi.droidsniff.helper.DialogHelper.java
public static void showDisclaimer(final Activity context) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setMessage(R.string.license); builder.setPositiveButton("Agree", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); }//from ww w . ja v a 2s . c o m }).setNegativeButton("Disagree", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { context.finish(); } }); builder.setCancelable(false); builder.show(); }
From source file:com.evozi.droidsniff.helper.DialogHelper.java
/** public static void downloadUpdate(Activity context) { try {/*from ww w . j av a2 s. com*/ String versionStr = getContentFromWeb("http://apps.evozi.com/android/droidsniff/version.php"); int versionWeb = Integer.valueOf(versionStr); PackageManager manager = context.getPackageManager(); PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0); int myVersion = info.versionCode; if (myVersion < versionWeb) { DialogHelper.context = context; String message = context.getString(R.string.updatetext); message += getContentFromWeb("http://apps.evozi.com/android/droidsniff/changelog.php"); AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setMessage(message).setCancelable(false) .setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.show(); } } catch (Exception e) { Log.e(Constants.APPLICATION_TAG, "Error while checking update: ", e); } } **/ public static void showUnrooted(Activity context) { DialogHelper.context = context; AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setMessage(R.string.unrooted).setCancelable(false).setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.show(); }
From source file:Main.java
/** * Creates a simple alert dialog with given params * * @param activity self explanatory// w ww. j a va 2s. co m * @param title self explanatory * @param message self explanatory */ public static void createAlertDialog(final Activity activity, String title, String message) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(activity); // set title alertDialogBuilder.setTitle(title); // set dialog message alertDialogBuilder.setMessage(message).setCancelable(false).setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // if this button is clicked, close // current activity dialog.cancel(); activity.finish(); } }); }
From source file:com.hackeruproj.android.havatzfit.general_utilities.GenUtils.java
public static void menuAlerts(Context context, int header, int theme, int img) { AlertDialog.Builder menuBuilder = new AlertDialog.Builder(context); LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View menuView = inflater.inflate(R.layout.inflater_alertdialog, null); menuBuilder.setView(menuView);/* w w w . j av a2 s . c om*/ TextView headerText = (TextView) menuView.findViewById(R.id.alertTxtHeader); TextView bodyText = (TextView) menuView.findViewById(R.id.alertTxtBody); ImageView imgView = (ImageView) menuView.findViewById(R.id.alertImgBody); headerText.setText(header); bodyText.setText(theme); imgView.setImageResource(img); menuBuilder.setNeutralButton("Ok", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); menuBuilder.show(); }
From source file:org.gplvote.signdoc.MainActivity.java
public static void alert(String text, final Activity activity, final boolean parent_exit) { final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(R.string.title_warning).setIcon(R.drawable.notification_icon).setMessage(text) .setCancelable(false).setNegativeButton(R.string.btn_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); if (parent_exit) { activity.finish(); }//w w w .j ava 2s .c o m } }); AlertDialog alert = builder.create(); alert.show(); }
From source file:org.gplvote.signdoc.MainActivity.java
public static void error(String text, final Activity activity, final boolean parent_exit) { AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(R.string.title_error).setIcon(R.drawable.cancel_icon).setMessage(text).setCancelable(false) .setNegativeButton(R.string.btn_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); if (parent_exit) { activity.finish(); }//w w w .java2 s. c o m } }); AlertDialog alert = builder.create(); alert.show(); }