Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.view.View;

public class Main {
    public static void showOkAlert(final Context context, String title, String message) {
        DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                ((AlertDialog) dialog).getButton(which).setVisibility(View.INVISIBLE);
            }
        };
        showOkAlertWithListener(context, title, message, listener);
    }

    public static void showOkAlertWithListener(final Context context, String title, String message,
            DialogInterface.OnClickListener dialogClickListener) {
        AlertDialog.Builder builder = new AlertDialog.Builder(context);
        builder.setTitle(title).setMessage(message).setPositiveButton("Ok", dialogClickListener).show();
    }
}