Example usage for android.app AlertDialog.Builder setMessage

List of usage examples for android.app AlertDialog.Builder setMessage

Introduction

In this page you can find the example usage for android.app AlertDialog.Builder setMessage.

Prototype

public void setMessage(CharSequence message) 

Source Link

Usage

From source file:Main.java

public static void showYesNoPrompt(Context _context, String title, String message,
        OnClickListener onYesListener, OnClickListener onNoListener) {
    AlertDialog.Builder builder = new AlertDialog.Builder(_context);
    builder.setTitle(title);/*from   w  ww  .j  av a  2 s .com*/
    builder.setIcon(android.R.drawable.ic_dialog_info); // lame icon
    builder.setMessage(message);
    builder.setCancelable(false);
    builder.setPositiveButton("Yes", onYesListener);
    builder.setNegativeButton("No", onNoListener);
    builder.show();
}

From source file:Main.java

public static void displayErrorStay(String message, Context context) {
    // no deals found so display a popup and return to search options
    AlertDialog.Builder builder = new AlertDialog.Builder(context);

    // set title//  w w  w  .j av  a2s  . c  o m
    builder.setTitle("No Results");

    // set dialog message
    builder.setMessage(message).setCancelable(false).setPositiveButton("Ok",
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();
                }
            });
    // create alert dialog
    AlertDialog alertDialog = builder.create();

    // show it
    alertDialog.show();
}

From source file:Main.java

public static void showGPSSettings(final Activity activity) {
    // check for internet connection
    AlertDialog.Builder alertDialog = new AlertDialog.Builder(activity);
    alertDialog.setTitle("GPS adapter disabled");
    alertDialog.setMessage("GPS is not enabled. Please enable GPS");
    // Setting Positive "Yes" Button
    alertDialog.setPositiveButton("Settings", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            activity.startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));
        }/*from  w  w w. jav  a2s  .com*/
    });
    // Setting Negative "NO" Button
    alertDialog.setNegativeButton("NO", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
        }
    });
    // Showing Alert Message
    alertDialog.show();
}

From source file:Main.java

public static void displayError(String message, final Class<?> activity, final Context context) {
    // no deals found so display a popup and return to search options
    AlertDialog.Builder builder = new AlertDialog.Builder(context);

    // set title//w  ww  . ja  va2 s  .  c  om
    builder.setTitle("No Results");

    // set dialog message
    builder.setMessage(message).setCancelable(false).setPositiveButton("Ok",
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();
                    Intent i = new Intent(context, activity);
                    ((Activity) (context)).finish();
                    i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NO_HISTORY);
                    context.startActivity(i);
                }
            });
    // create alert dialog
    AlertDialog alertDialog = builder.create();

    // show it
    alertDialog.show();
}

From source file:com.evozi.droidsniff.helper.DialogHelper.java

/**
public static void downloadUpdate(Activity context) {
   try {//w  w w .j a v a2 s. c  o  m
 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

public static void createNonCancellableAcceptOrCancelDialog(Context context, String title, String message,
        String acceptButtonText, String cancelButtonText, final Runnable onAccept, final Runnable onCancel) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setCancelable(false);//from w ww  .j  a v a  2 s  . c  om
    builder.setTitle(title);
    builder.setMessage(message);
    builder.setInverseBackgroundForced(true);
    builder.setPositiveButton(acceptButtonText, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
            if (onAccept != null)
                onAccept.run();
        }
    });

    builder.setNegativeButton(cancelButtonText, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
            if (onCancel != null)
                onCancel.run();
        }
    });
    AlertDialog alert = builder.create();
    alert.setOnKeyListener(new DialogInterface.OnKeyListener() {
        @Override
        public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
            if (keyCode == KeyEvent.KEYCODE_SEARCH && event.getRepeatCount() == 0) {
                return true; // Pretend we processed it
            }
            return false; // Any other keys are still processed as normal
        }
    });
    alert.show();
}

From source file:com.evozi.droidsniff.helper.DialogHelper.java

public static void clearBlacklist(Activity context) {
    DialogHelper.context = context;/*from   w w w . j  a va2s . co m*/
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setMessage(R.string.clear_blacklist).setCancelable(false)
            .setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    DBHelper.clearBlacklist(DialogHelper.context);
                    AuthHelper.clearBlacklist();
                }
            }).setNegativeButton(R.string.button_no, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();
                }
            });
    AlertDialog alert = builder.create();
    alert.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  w w w .  j a v  a  2 s. 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:Main.java

public static void showMessage(Context context, String title, String message, OnDismissListener listener) {
    AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);

    // set title/*from   ww  w  . j  a va 2  s. co  m*/
    alertDialogBuilder.setTitle(title);

    // set dialog message
    alertDialogBuilder.setMessage(message).setCancelable(true);

    // create alert dialog
    AlertDialog alertDialog = alertDialogBuilder.create();

    alertDialog.setCanceledOnTouchOutside(true);
    if (listener != null)
        alertDialog.setOnDismissListener(listener);
    // show it
    alertDialog.show();
}

From source file:com.evozi.droidsniff.helper.DialogHelper.java

public static void installBusyBox(Activity context) {
    DialogHelper.context = context;//from  w  w  w .  j a  v  a2  s .  co  m
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setMessage(R.string.installbusybox).setCancelable(false)
            .setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    Intent goToMarket = null;
                    goToMarket = new Intent(Intent.ACTION_VIEW,
                            Uri.parse("market://details?id=stericson.busybox"));
                    DialogHelper.context.startActivity(goToMarket);
                    dialog.cancel();
                }
            }).setNegativeButton(R.string.button_no, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();
                }
            });
    AlertDialog alert = builder.create();
    alert.show();
}