Android AlertDialog Create alert(Context act, String msg)

Here you can find the source of alert(Context act, String msg)

Description

alert

Declaration

public static void alert(Context act, String msg) 

Method Source Code

//package com.java2s;
import android.app.AlertDialog;
import android.content.Context;

public class Main {
    private static AlertDialog alert;

    public static void alert(Context act, int strId) {
        String msg = act.getResources().getString(strId);
        alert(act, msg);//from  w ww  .  j  a  v a 2  s . c o  m
    }

    public static void alert(Context act, String msg) {
        AlertDialog.Builder builder = new AlertDialog.Builder(act);
        builder.setMessage(msg);
        alert = builder.create();
        alert.show();
    }
}

Related

  1. showAlert(Context context, int titleId, int messageId)
  2. showAlert(Context context, int titleId, int messageId, CharSequence positiveButtontxt, DialogInterface.OnClickListener positiveListener, CharSequence negativeButtontxt, DialogInterface.OnClickListener negativeListener)
  3. showAlert(Context parent, String alert)
  4. showAlertText(String alertText, Context context)
  5. showInfoDialog(Context context, String message, String titleStr, String positiveStr, DialogInterface.OnClickListener onClickListener)
  6. alert(Context act, int strId)
  7. showErrorDialog(Context context, int title, int message)
  8. showAlertDialog(Activity ctx, String title, String text)
  9. createAlertDialog(Context cx, String title, String message)