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:com.theelix.libreexplorer.FileManager.java

/**
 * This Method use the file set by prepareCopy or PrepareCut and then paste the files
 *//*from   w w  w. ja  v  a2  s  .c o m*/
public static void preparePaste() {
    //If we are running KK or later, show the "Choose Folder" dialog
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
            && getCurrentDirectory().getPath().contains(System.getenv("SECONDARY_STORAGE"))) {
        AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
        builder.setMessage(
                "As Android 5.0, a new system is used for writing files to External Storage. Please press OK and Select THE EXACT FOLDER you pasted the files");
        builder.setPositiveButton(mContext.getString(R.string.dialog_ok),
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
                        ((Activity) mContext).startActivityForResult(intent, REQUEST_GET_DOCUMENT);
                    }
                });
        builder.create().show();
    } else {
        createDestFiles();
    }
}

From source file:com.doplgangr.secrecy.Util.java

public static void alert(final Context context, final String title, final String message,
        final DialogInterface.OnClickListener positive, final DialogInterface.OnClickListener negative) {
    new Handler(Looper.getMainLooper()).post(new Runnable() {

        @Override//from  w  w w . j  av  a 2  s . c  o m
        public void run() {
            AlertDialog.Builder a = new AlertDialog.Builder(context);
            if (title != null)
                a.setTitle(title);
            if (message != null)
                a.setMessage(message);
            if (positive != null)
                a.setPositiveButton(context.getString(R.string.OK), positive);
            if (negative != null)
                a.setNegativeButton(context.getString(R.string.CANCEL), negative);
            a.setCancelable(false);
            a.show();
        }

    });
}

From source file:Main.java

public static AlertDialog newMessageDialog(final Activity activity, String dialogTitle, String screenMessage,
        int iconResourceId) {
    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    builder.setCancelable(false);// www  .  j a  v  a  2 s.co m
    builder.setPositiveButton("Okay", new OnClickListener() {

        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });

    builder.setTitle(dialogTitle);
    builder.setMessage(screenMessage);
    builder.setIcon(iconResourceId);

    return builder.create();
}

From source file:com.doplgangr.secrecy.utils.Util.java

public static void alert(final Context context, final String title, final String message,
        final DialogInterface.OnClickListener ok) {
    new Handler(Looper.getMainLooper()).post(new Runnable() {

        @Override//from  ww w .  ja v  a  2  s  .  c  o  m
        public void run() {
            AlertDialog.Builder a = new AlertDialog.Builder(context);
            if (title != null)
                a.setTitle(title);
            if (message != null)
                a.setMessage(message);
            if (ok != null)
                a.setPositiveButton("OK", ok);
            a.setCancelable(false);
            a.show();
        }

    });
}

From source file:com.doplgangr.secrecy.utils.Util.java

public static void alert(final Context context, final String title, final String message,
        final DialogInterface.OnClickListener positive, final DialogInterface.OnClickListener negative) {
    new Handler(Looper.getMainLooper()).post(new Runnable() {

        @Override/*from  ww  w. j ava2  s  . co  m*/
        public void run() {
            AlertDialog.Builder a = new AlertDialog.Builder(context);
            if (title != null)
                a.setTitle(title);
            if (message != null)
                a.setMessage(message);
            if (positive != null)
                a.setPositiveButton("OK", positive);
            if (negative != null)
                a.setNegativeButton("CANCEL", negative);
            a.setCancelable(false);
            a.show();
        }

    });
}

From source file:Main.java

/**
 * Creates a new AlertDialog to display a simple message
 * /*www  . j av a 2  s  .  c om*/
 * @param context
 * @param dialogTitle
 * @param screenMessage
 * @param iconResourceId
 * @return
 */
public static AlertDialog newMessageDialog(final Context context, String dialogTitle, String screenMessage,
        int iconResourceId) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setCancelable(false);
    builder.setPositiveButton("Okay", new OnClickListener() {

        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });

    builder.setTitle(dialogTitle);
    builder.setMessage(screenMessage);
    builder.setIcon(iconResourceId);

    return builder.create();
}

From source file:au.id.micolous.frogjump.Util.java

private static void newVersionAlert(final Activity activity) {
    // We have a new version available.  Prompt.
    AlertDialog.Builder updateDialog = new AlertDialog.Builder(activity);
    updateDialog.setTitle(R.string.update_available_title);
    updateDialog.setMessage(R.string.update_available_message);
    updateDialog.setPositiveButton(R.string.update_positive, new DialogInterface.OnClickListener() {
        @Override/* w  ww  .  j  ava  2  s  .co  m*/
        public void onClick(DialogInterface dialogInterface, int i) {
            try {
                activity.startActivity(
                        new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + getPackageName())));
            } catch (ActivityNotFoundException anfe) {
                // Hmm, market is not installed
                Log.w(TAG, "Google Play is not installed; cannot install update");
            }
        }
    });
    updateDialog.setNegativeButton(R.string.update_negative, null);
    updateDialog.setCancelable(true);
    updateDialog.show();

}

From source file:Main.java

public static AlertDialog newMessageDialog(Context context, String s, String s1, int i) {
    android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(context);
    builder.setCancelable(false);//  w  w  w  . j  ava2 s.c  o  m
    builder.setPositiveButton("Okay", new android.content.DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialoginterface, int j) {
            dialoginterface.dismiss();
        }

    });
    builder.setTitle(s);
    builder.setMessage(s1);
    builder.setIcon(i);
    return builder.create();
}

From source file:com.escabe.TraktApi.java

public static boolean Login(String u, String p) {
    username = u;/*from ww  w  .  j  av a  2s  .  c  o m*/
    password = p;
    JSONObject data = getDataObjectFromJSON("", true);
    if (data == null) {
        AlertDialog.Builder alert = new AlertDialog.Builder(trakt.instance);
        alert.setTitle("Trakt.tv");
        alert.setMessage("Login Failed!\nPlease check login details.");
        alert.setIcon(android.R.drawable.ic_dialog_alert);
        alert.setPositiveButton("OK", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface arg0, int arg1) {
                trakt.instance.myflipper.FlipTo(MyView.SETTINGS);
            }
        });
        alert.show();
        return false;
    } else {
        return true;
    }
}

From source file:ee.ioc.phon.android.speak.Utils.java

public static AlertDialog getYesNoDialog(Context context, String confirmationMessage, final Executable ex) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setMessage(confirmationMessage).setCancelable(false)
            .setPositiveButton(context.getString(R.string.buttonYes), new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    ex.execute();//w  w w.j  av a 2  s . c  o m
                }
            }).setNegativeButton(context.getString(R.string.buttonNo), new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();
                }
            });
    return builder.create();
}