Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.app.Activity;
import android.app.AlertDialog;

import android.content.DialogInterface;

public class Main {
    public static void alert(String title, String message, Activity activity) {
        alert(title, message, activity, null);
    }

    public static void alert(String title, String message, Activity activity,
            DialogInterface.OnClickListener listener) {
        AlertDialog.Builder builder = new AlertDialog.Builder(activity);
        builder.setTitle(title);
        builder.setMessage(message);
        builder.setPositiveButton("OK", listener);
        AlertDialog alert = builder.create();
        alert.show();
    }
}