Android AlertDialog Create showAlert(Activity activity, int messageStringId)

Here you can find the source of showAlert(Activity activity, int messageStringId)

Description

show Alert

Declaration

public static void showAlert(Activity activity, int messageStringId) 

Method Source Code

//package com.java2s;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.res.Resources;

public class Main {
    public static void showAlert(Activity activity, String title,
            String message) {/*w w w . j  a va2 s  . co  m*/
        AlertDialog.Builder ad = new AlertDialog.Builder(activity);
        ad.setTitle(title);
        ad.setMessage(message);
        ad.setNegativeButton("OK", null);
        ad.setCancelable(true);
        ad.show();
    }

    public static void showAlert(Activity activity, String message) {
        showAlert(activity, "", message);
    }

    public static void showAlert(Activity activity, int titleStringId,
            int messageStringId) {
        Resources res = activity.getResources();
        showAlert(activity, res.getString(titleStringId),
                res.getString(messageStringId));
    }

    public static void showAlert(Activity activity, int messageStringId) {
        Resources res = activity.getResources();
        showAlert(activity, "", res.getString(messageStringId));
    }
}

Related

  1. createOpenSourceDialog( final Context context)
  2. showAlert(Activity activity, String message)
  3. showAlert(Activity activity, String title, String message)
  4. showAlert(Activity activity, int titleStringId, int messageStringId)
  5. showAlert(Context context, int titleId, String message)
  6. showAlert(Context context, int titleId, String message, CharSequence positiveButtontxt, DialogInterface.OnClickListener positiveListener)
  7. showAlert(Context context, int titleId, int messageId)