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:it.uniroma2.foundme.studente.FollowCourseActivity.java

public static void alertMessage(final String info) {
    DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            switch (which) {
            case DialogInterface.BUTTON_POSITIVE:
                extractData(info);/*w w w.  ja  v  a  2  s  .co  m*/
                try {
                    managefollowing(title, cfu, prof, Sid);
                } catch (ExecutionException e) {
                    e.printStackTrace();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                break;
            case DialogInterface.BUTTON_NEGATIVE:
                break;
            }
        }
    };

    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setMessage(Variables_it.FOLLOW_REQUEST).setNegativeButton(Variables_it.NO, dialogClickListener)
            .setPositiveButton(Variables_it.YES, dialogClickListener).show();
}

From source file:Main.java

public static void showDialogBox(Context context, String title, String msg, int icon) {
    AlertDialog.Builder ad = new AlertDialog.Builder(context);
    ad.setTitle(title);/*from  w ww .j  av a  2  s .  c  o m*/
    ad.setPositiveButton(android.R.string.ok, null);
    if (icon <= 0)
        ad.setIcon(android.R.drawable.ic_dialog_alert);
    else
        ad.setIcon(icon);
    ad.setMessage(msg);
    ad.show();
}

From source file:palamarchuk.fraudguide.utils.QueryMaster.java

public static AlertDialog.Builder alertBuilder(Context context, String message) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setMessage(message);
    //        builder.setTitle("");

    return builder;
}

From source file:palamarchuk.fraudguide.utils.QueryMaster.java

public static AlertDialog alert(Context context, String message) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setMessage(message);
    //        builder.setTitle("");

    builder.setPositiveButton("Ok", null);
    return builder.show();
}

From source file:Main.java

public static AlertDialog newYesNoDialog(final Activity activity, String dialogTitle, String screenMessage,
        int iconResourceId, OnClickListener listener) {
    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    builder.setCancelable(false);/*  ww  w  . java  2  s. c o  m*/
    builder.setPositiveButton(android.R.string.yes, listener);
    builder.setNegativeButton(android.R.string.no, listener);

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

    return builder.create();
}

From source file:com.nadmm.airports.utils.NetworkUtils.java

public static void checkNetworkAndDownload(Context context, final Runnable runnable) {
    if (!NetworkUtils.isNetworkAvailable(context)) {
        UiUtils.showToast(context, "Please check your internet connection");
    }//from w w w .  j  ava 2 s . co m

    if (NetworkUtils.isConnectedToMeteredNetwork(context)) {
        AlertDialog.Builder builder = new AlertDialog.Builder(context);
        builder.setMessage("You are conneteced to a metered network such as mobile data"
                + " or tethered to mobile data.\nContinue download?")
                .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int id) {
                        runnable.run();
                    }
                }).setNegativeButton("No", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int id) {
                    }
                });
        AlertDialog alert = builder.create();
        alert.show();
    } else {
        runnable.run();
    }
}

From source file:Main.java

/**
 * Creates a new Yes/No AlertDialog/*from  w ww.j a va 2 s .co m*/
 * 
 * @param context
 * @param dialogTitle
 * @param screenMessage
 * @param iconResourceId
 * @param listener
 * @return
 */
public static AlertDialog newYesNoDialog(final Context context, String dialogTitle, String screenMessage,
        int iconResourceId, OnClickListener listener) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setCancelable(false);
    builder.setPositiveButton(android.R.string.yes, listener);
    builder.setNegativeButton(android.R.string.no, listener);

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

    return builder.create();
}

From source file:org.cinedroid.util.CineworldAPIAssistant.java

/**
 * Create a dialog with the text "Problem connecting to the Cineworld API", with two buttons, "Retry", which will re run the task, and
 * "Back" which will close the owningActivity.
 * /* www  .j  a  v  a2s .  co  m*/
 * @param owningActivity
 * @param task
 */
public static void createCineworldAPIErrorDialog(final Activity owningActivity, final ResurrectableTask task) {
    AlertDialog.Builder builder = new AlertDialog.Builder(owningActivity);
    builder.setMessage("Problem connecting to the Cineworld API");
    builder.setCancelable(false);
    builder.setPositiveButton("Retry", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(final DialogInterface dialog, final int which) {
            task.resurrect();
        }
    });
    builder.setNegativeButton("Back", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(final DialogInterface dialog, final int which) {
            owningActivity.finish();

        }
    });
    builder.create().show();
}

From source file:br.ufg.inf.es.fs.contpatri.mobile.webservice.Autenticar.java

/**
 * Mtodo que exibe um <code>Dialog</code> caso haja erro no login do
 * usurio no aplicativo.//from  www.  j  a v a2 s.  c om
 * 
 * @param contexto
 *            <code>Context</code> necessrio para criar e exibir a caixa de
 *            dilogo.
 * @param mensagem
 *            mensagem de erro que ser exibida na <code>Dialog</code> para
 *            informar o motivo de a aplicao no realizar o login
 *            corretamente
 */
public static void mostrarDialogo(final Context contexto, final String mensagem) {

    AlertDialog.Builder builder;
    builder = new AlertDialog.Builder(contexto);

    builder.setTitle("Erro");
    builder.setMessage(mensagem);
    builder.setIcon(android.R.drawable.ic_dialog_alert);

    builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(final DialogInterface dialog, final int which) {
            dialog.dismiss();
        }
    });

    final AlertDialog dialog = builder.create();
    dialog.setCanceledOnTouchOutside(true);
    dialog.show();

}

From source file:net.naonedbus.utils.InfoDialogUtils.java

/**
 * Crer une dialog avec le titre et le contenu donn.
 * //  w w w .  java 2  s .co m
 * @param context
 * @param titleId
 * @param messageId
 * @return La dialogue.
 */
public static AlertDialog getDialog(final Context context, final int titleId, final int messageId) {

    final AlertDialog.Builder moreDetailsDialog = new AlertDialog.Builder(context);
    moreDetailsDialog.setTitle(context.getString(titleId));
    moreDetailsDialog.setMessage(context.getString(messageId));
    moreDetailsDialog.setPositiveButton(android.R.string.ok, null);

    return moreDetailsDialog.create();
}