Example usage for android.app AlertDialog.Builder show

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

Introduction

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

Prototype

public void show() 

Source Link

Document

Start the dialog and display it on screen.

Usage

From source file:Main.java

public static void isGPSActivated(final Context context) {
    LocationManager lm = null;//from w  ww. j a v  a 2 s . c  om
    boolean gpsEnabled = false;
    if (lm == null)
        lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
    try {
        gpsEnabled = lm.isProviderEnabled(LocationManager.GPS_PROVIDER);
    } catch (Exception ex) {
    }

    if (!gpsEnabled) {
        AlertDialog.Builder dialog = new AlertDialog.Builder(context);

        dialog.setCancelable(false);
        dialog.show();

    }
}

From source file:Main.java

static public void ok_dialog(Context ctx, String title, String text) {
    AlertDialog.Builder ad;
    ad = new AlertDialog.Builder(ctx);
    ad.setTitle(title);/*from   ww w.ja  v a2 s.  c  o m*/
    ad.setMessage(text);
    ad.setPositiveButton("Ok", null);
    ad.show();
}

From source file:Main.java

public static void okButtonAlertDialog(String message, Context context) {
    AlertDialog.Builder alertDialog = new AlertDialog.Builder(context);
    alertDialog.setMessage(message);//from   ww  w .  j  av a  2s. c o m
    alertDialog.setPositiveButton("Ok", null);
    alertDialog.setCancelable(false);
    alertDialog.show();
}

From source file:Main.java

/**
 * //from   w  w  w  . j  av  a 2 s  .com
 * @param context
 * @param strTitle
 * @param strText
 * @param icon
 */
public static void showDialog(Activity context, String strTitle, String strText, int icon) {
    AlertDialog.Builder tDialog = new AlertDialog.Builder(context);
    tDialog.setTitle(strTitle);
    tDialog.setMessage(strText);
    tDialog.setPositiveButton(android.R.string.ok, null);
    tDialog.show();
}

From source file:Main.java

public static void showDialog(Activity context, String strTitle, String strText, int icon) {
    AlertDialog.Builder tDialog = new AlertDialog.Builder(context);
    tDialog.setIcon(icon);//from ww w . ja v  a 2  s.  c  om
    tDialog.setTitle(strTitle);
    tDialog.setMessage(strText);
    tDialog.setPositiveButton("Sure", null);
    tDialog.show();
}

From source file:Main.java

/**
 * Returns an Alert Dialog with one button and title.
 * @param context               -The activity which need this alert.
 * @param title                 -The alert title.
 * @param message               -The alert message.
 * @param positiveBtnLabel      -The positive button label.
 * @param positiveClickListener -The positive button listener.
 * @return - An alert dialog.//from   w  w  w. ja  v  a2 s. co  m
 */
public static AlertDialog.Builder getAlertDialogWithOneButtonAndTitle(Context context, String title,
        String message, String positiveBtnLabel, DialogInterface.OnClickListener positiveClickListener) {

    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle(title);
    builder.setMessage(message).setPositiveButton(positiveBtnLabel, positiveClickListener);
    builder.show();
    return builder;
}

From source file:Main.java

public static void showDialog(Activity context, String strTitle, String strText, String BtnEnsure) {
    AlertDialog.Builder tDialog = new AlertDialog.Builder(context);
    //      tDialog.setIcon(icon);
    tDialog.setTitle(strTitle);/*from   w w  w  .  j av a  2s.  co m*/
    tDialog.setMessage(strText);
    tDialog.setPositiveButton(BtnEnsure, null);
    tDialog.show();
}

From source file:Main.java

public static void addMsgOk(Activity activity, String titulo, String msg, int icone) {
    AlertDialog.Builder builderDialog = new AlertDialog.Builder(activity);
    builderDialog.setTitle(titulo);/*from   ww  w . j av a  2s . c  o m*/
    builderDialog.setMessage(msg);
    builderDialog.setNeutralButton("Ok", null);
    builderDialog.setIcon(icone);
    builderDialog.show();
}

From source file:Main.java

public static void showAlertDialog(Context context, String title, String message) {
    AlertDialog.Builder dialog = new AlertDialog.Builder(context);
    dialog.setTitle(title);//www . jav a2 s  . co m
    dialog.setMessage(message);
    dialog.setIcon(android.R.drawable.ic_dialog_alert);
    dialog.setPositiveButton(android.R.string.ok, null);
    dialog.show();
}

From source file:com.lge.friendsCamera.Utils.java

public static void showListDialog(Context context, CharSequence[] list,
        DialogInterface.OnClickListener listener) {
    AlertDialog.Builder alert = new AlertDialog.Builder(context);
    alert.setItems(list, listener);//  w ww.  j  av  a 2s  .c  om
    alert.show();
}