Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.app.AlertDialog;

import android.content.Context;
import android.content.DialogInterface;

public class Main {
    public static void showDialog(Context context, String title, String message, String buttonText) {
        showDialog(context, title, message, buttonText, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            }
        });
    }

    public static void showDialog(Context context, String title, String message, String buttonText,
            DialogInterface.OnClickListener buttonClickListener) {
        AlertDialog.Builder dlg = new AlertDialog.Builder(context);
        dlg.setTitle(title);
        dlg.setMessage(message);
        dlg.setCancelable(false);
        dlg.setPositiveButton(buttonText, buttonClickListener);
        dlg.create();
        dlg.show();
    }
}