show Ok Alert Dialog - Android User Interface

Android examples for User Interface:Alert Dialog

Description

show Ok Alert Dialog

Demo Code


//package com.java2s;

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

public class Main {

    public static AlertDialog showOkAlertDialog(Context context,
            String title, String message,
            DialogInterface.OnClickListener onOkClickListener) {
        AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
                context);/*ww w  . j  a  v  a 2s  .  com*/
        alertDialogBuilder.setTitle(title);
        alertDialogBuilder.setMessage(message);
        alertDialogBuilder.setCancelable(false);
        alertDialogBuilder.setPositiveButton("OK", onOkClickListener);
        alertDialogBuilder.create();
        return alertDialogBuilder.show();
    }
}

Related Tutorials