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:org.ubicompforall.cityexplorer.gui.ImportWebTab.java

/**
  * Display a dialog for explaining the user the process of downloading a database.
  *//*from  w w  w .j  ava  2  s . co  m*/
private static void showDownloadDialog(Activity context) {

    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setCancelable(true);

    builder.setMessage(R.string.download_dialog);
    builder.setTitle(R.string.download_dialog_title);

    builder.setPositiveButton(R.string.download_dialog_ok, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            return;
        }
    });

    builder.show();
}

From source file:org.cocos2dx.lib.CCUtils.java

static void showConfirmDialog(final String title, final String text, final String positiveButton,
        final String negativeButton, final long okFunc, final long cancelFunc) {
    nativeRetain(okFunc);/*w w w .  ja  v  a2s  .  co m*/
    nativeRetain(cancelFunc);

    final Cocos2dxActivity act = (Cocos2dxActivity) Cocos2dxActivity.getContext();
    act.runOnUiThread(new Runnable() {
        public void run() {
            AlertDialog.Builder builder = new Builder(act);
            if (title != null)
                builder.setTitle(title);
            if (text != null)
                builder.setMessage(text);
            if (positiveButton != null) {
                builder.setPositiveButton(positiveButton, new OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        act.runOnGLThread(new Runnable() {
                            @Override
                            public void run() {
                                nativeExecuteCallFunc(okFunc);
                                nativeRelease(okFunc);
                            }
                        });
                    }
                });
            }
            if (negativeButton != null) {
                builder.setNegativeButton(negativeButton, new OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        act.runOnGLThread(new Runnable() {
                            @Override
                            public void run() {
                                nativeExecuteCallFunc(cancelFunc);
                                nativeRelease(cancelFunc);
                            }
                        });
                    }
                });
            }

            builder.show();
        }
    });
}

From source file:air.com.snagfilms.utils.Utils.java

public static AlertDialog showConfirmationDialog(String title, Context mContext) {

    AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
            new ContextThemeWrapper(mContext, R.style.AlertDialogCustom));
    if (title != null) {
        alertDialogBuilder.setMessage(title);
    } else {// ww w  .jav a 2 s  .  co  m
        alertDialogBuilder.setMessage("INFO:");
    }

    alertDialogBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    return alertDialogBuilder.create();

}

From source file:com.spoiledmilk.cykelsuperstier.navigation.SMRouteNavigationActivity.java

public static void showRouteNoBreakDialog(final Context context, AlertDialog dialog) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle(CykelsuperstierApplication.getString("no_route"));
    builder.setMessage(CykelsuperstierApplication.getString("cannot_broken"));
    builder.setPositiveButton("OK", new OnClickListener() {
        @Override/*from   w ww  . java2 s  .co  m*/
        public void onClick(DialogInterface dialog, int arg1) {
            dialog.dismiss();
        }
    });
    dialog = builder.create();
    dialog.setCancelable(false);
    dialog.show();
}

From source file:com.spoiledmilk.ibikecph.util.Util.java

public static void showSimpleMessageDlg(Context context, String message) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setMessage(message)
            .setPositiveButton(IbikeApplication.getString("OK"), new DialogInterface.OnClickListener() {
                @Override//from   ww  w .  jav a  2 s.  co  m
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            }).show();
}

From source file:com.bt.download.android.gui.util.UIUtils.java

/**
 * /*from w ww  .  j av a2 s  . c om*/
 * @param context
 * @param messageId
 * @param titleId
 * @param positiveListener
 * @param negativeListener
 */
public static Dialog showYesNoDialog(Context context, int messageId, int titleId,
        OnClickListener positiveListener, OnClickListener negativeListener) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setMessage(messageId).setTitle(titleId).setCancelable(false)
            .setPositiveButton(android.R.string.yes, positiveListener)
            .setNegativeButton(android.R.string.no, negativeListener);
    Dialog dialog = builder.create();
    dialog.show();
    return dialog;
}

From source file:com.bt.download.android.gui.util.UIUtils.java

public static void showYesNoDialog(Context context, String message, int titleId,
        OnClickListener positiveListener, OnClickListener negativeListener) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);

    builder.setMessage(message).setTitle(titleId).setCancelable(false)
            .setPositiveButton(android.R.string.yes, positiveListener)
            .setNegativeButton(android.R.string.no, negativeListener);

    builder.create().show();//www. j ava 2  s.  c om
}

From source file:com.todotxt.todotxttouch.util.Util.java

public static void showDialog(Context cxt, int titleid, int msgid) {
    AlertDialog.Builder builder = new AlertDialog.Builder(cxt);
    builder.setTitle(titleid);/* w  ww  .  j a v a  2  s.c o m*/
    builder.setMessage(msgid);
    builder.setPositiveButton(android.R.string.ok, null);
    builder.setCancelable(true);
    builder.show();
}

From source file:com.todotxt.todotxttouch.util.Util.java

public static void showDialog(Context cxt, int titleid, String msg) {
    AlertDialog.Builder builder = new AlertDialog.Builder(cxt);
    builder.setTitle(titleid);//from   w  ww.  j av a2 s  .c  o  m
    builder.setMessage(msg);
    builder.setPositiveButton(android.R.string.ok, null);
    builder.setCancelable(true);
    builder.show();
}

From source file:Main.java

public static void showOkDialog(String title, String msg, Activity act) {
    AlertDialog.Builder dialog = new AlertDialog.Builder(act);
    if (title != null) {

        TextView dialogTitle = new TextView(act);
        dialogTitle.setText(title);/*ww  w  .  java  2s.co  m*/
        dialogTitle.setPadding(10, 10, 10, 10);
        dialogTitle.setGravity(Gravity.CENTER);
        dialogTitle.setTextColor(Color.WHITE);
        dialogTitle.setTextSize(20);
        dialog.setCustomTitle(dialogTitle);

    }
    if (msg != null) {
        dialog.setMessage(msg);
    }
    dialog.setPositiveButton("OK", new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            // TODO Auto-generated method stub
            dialog.dismiss();
        }
    });
    AlertDialog dlg = dialog.show();
    TextView messageText = (TextView) dlg.findViewById(android.R.id.message);
    messageText.setGravity(Gravity.CENTER);

}