Example usage for android.app AlertDialog setMessage

List of usage examples for android.app AlertDialog setMessage

Introduction

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

Prototype

public void setMessage(CharSequence message) 

Source Link

Usage

From source file:br.unicamp.busfinder.ServerOperations.java

public static void nextBuses(final String title, final Context c) {

    int stopid = Integer.parseInt(title.split("_")[0]);

    String req = BusFinderActivity.SERVER + "getNextBus?stopid=";
    JSONArray jar = getJSON(req + stopid);
    String display = "";
    try {// w w  w  .  ja v a 2s  .c o  m

        for (int i = 0; i < jar.length(); i++) {
            JSONObject jos = jar.getJSONObject(i);
            String circular = jos.getString("circular");
            String time = jos.getString("time");

            display += "--" + circular + "------" + time + "\n";

        }

        final String display_ = display;

        AlertDialog dialog = new AlertDialog.Builder(c).create();

        dialog.setTitle(title);
        dialog.setMessage(display_);
        dialog.setCanceledOnTouchOutside(true);
        dialog.show();

        return;

    } catch (JSONException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }

    Toast.makeText(c, "Error or no Connection ..", Toast.LENGTH_SHORT).show();

}

From source file:com.cranberrygame.cordova.plugin.ad.adbuddiz.Util.java

public static void alert(Activity activity, String message) {
    AlertDialog ad = new AlertDialog.Builder(activity).create();
    ad.setCancelable(false); // This blocks the 'BACK' button  
    ad.setMessage(message);
    ad.setButton("OK", new DialogInterface.OnClickListener() {
        @Override/*from ww w .  j a v a  2 s . com*/
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    ad.show();
}

From source file:com.hemou.android.account.AccountUtils.java

/**
 * Show conflict message about previously registered authenticator from
 * another application//from  ww  w  .  j ava2s  .co  m
 * 
 * @param activity
 */
private static void showConflictMessage(final Activity activity) {
    AlertDialog dialog = LightAlertDialog.create(activity);
    dialog.setTitle(activity.getString(string.authenticator_conflict_title));
    dialog.setMessage(activity.getString(string.authenticator_conflict_message));
    dialog.setOnCancelListener(new OnCancelListener() {

        @Override
        public void onCancel(DialogInterface dialog) {
            activity.finish();
        }
    });
    dialog.setButton(BUTTON_POSITIVE, activity.getString(android.R.string.ok), new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            activity.finish();
        }
    });
    dialog.show();
}

From source file:de.wikilab.android.friendica01.Max.java

public static void alert(Context ctx, String text, String title, String okButtonText) {
    AlertDialog ad = new AlertDialog.Builder(ctx).create();
    ad.setCancelable(false); // This blocks the 'BACK' button  
    ad.setMessage(Html.fromHtml(text));
    ad.setTitle(title);/* w ww .j a v a 2 s .  com*/
    ad.setButton(okButtonText, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    ad.show();
    ((TextView) ad.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
}

From source file:com.max2idea.android.fwknop.Fwknop.java

public static void UIAlert(String title, String body, Activity activity) {
    AlertDialog ad;
    ad = new AlertDialog.Builder(activity).create();
    ad.setTitle(title);/*from  www  .  j  a va  2s.co  m*/
    ad.setMessage(body);
    ad.setButton("OK", new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int which) {
            return;
        }
    });
    ad.show();
}

From source file:com.renren.api.connect.android.Util.java

/**
 * ???UI/*from w ww  . j a v a  2 s. c  o  m*/
 * 
 * @param context
 * @param title
 * @param text
 */
public static void showAlert(Context context, String title, String text, boolean showOk) {
    AlertDialog alertDialog = new Builder(context).create();
    alertDialog.setTitle(title);
    alertDialog.setMessage(text);
    if (showOk) {
        OnClickListener listener = null;
        alertDialog.setButton2("", listener);
    }
    alertDialog.show();
}

From source file:com.iStudy.Study.Renren.Util.java

/**
 * ???UI/*from  ww  w .j av a2s . c o  m*/
 * 
 * @param context
 * @param title
 * @param text
 */
@SuppressWarnings("deprecation")
public static void showAlert(Context context, String title, String text, boolean showOk) {
    AlertDialog alertDialog = new Builder(context).create();
    alertDialog.setTitle(title);
    alertDialog.setMessage(text);
    if (showOk) {
        OnClickListener listener = null;
        alertDialog.setButton2("", listener);
    }
    alertDialog.show();
}

From source file:com.iStudy.Study.Renren.Util.java

/**
 * ??????/*from   ww  w. j a v  a  2  s  .  co m*/
 * 
 * @param activity ?Activity
 * @param title   ?
 * @param text   ?
 * @param listener ?
 */
public static void showOptionWindow(Activity activity, String title, String text, OnOptionListener listener) {
    AlertDialog dialog = new AlertDialog.Builder(activity).create();
    if (title != null) {
        dialog.setTitle(title);
    }

    if (text != null) {
        dialog.setMessage(text);
    }

    final OnOptionListener oListener = listener;
    dialog.setButton(AlertDialog.BUTTON_POSITIVE, activity.getString(R.string.renren_sdk_submit),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    oListener.onOK();
                }
            });
    dialog.setButton(AlertDialog.BUTTON_NEGATIVE, activity.getString(R.string.renren_sdk_cancel),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    oListener.onCancel();
                }
            });
    dialog.show();
}

From source file:org.restcomm.app.qoslib.Utils.QosAPI.java

public static void showQoSPanel(final Activity activity) {
    try {//from  w  w w . j  ava 2  s  .c o  m
        AlertDialog.Builder builder1 = new AlertDialog.Builder(activity);
        CharSequence qosInfo = getQosInfo(activity);
        builder1.setMessage(qosInfo);
        builder1.setTitle("QOS Info");
        builder1.setCancelable(true);
        final AlertDialog alert11 = builder1.create();
        alert11.show();
        final Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                CharSequence qosInfo = getQosInfo(activity);
                if (alert11.isShowing()) {
                    try {
                        alert11.setMessage(qosInfo);
                        handler.postDelayed(this, 1000);
                    } catch (Exception e) {
                    }
                }
            }
        }, 1000);

    } catch (Exception e) {
        LoggerUtil.logToFile(LoggerUtil.Level.ERROR, TAG, "CreateDevInfoAlertDialog", "exeption", e);
    }
}

From source file:com.star.printer.StarPrinter.java

private static void ShowAlert(String Title, String Message) {
    Builder dialog = new AlertDialog.Builder(mContext);
    dialog.setNegativeButton("Ok", null);
    AlertDialog alert = dialog.create();
    alert.setTitle(Title);/*ww  w . jav  a 2s .  c om*/
    alert.setMessage(Message);
    alert.setCancelable(false);
    alert.show();

}