show Info Dialog - Android User Interface

Android examples for User Interface:Dialog

Description

show Info Dialog

Demo Code


//package com.java2s;

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

public class Main {
    public static void showInfoDialog(Context context, int titleID,
            int messageID, int okID) {
        String title = context.getResources().getString(titleID);
        String message = context.getResources().getString(messageID);
        new AlertDialog.Builder(context)
                .setIcon(android.R.drawable.ic_dialog_info)
                .setTitle(title)//from  w  w w  . j  a v  a  2 s . c  o m
                .setMessage(message)
                .setPositiveButton(okID,
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog,
                                    int which) {
                                dialog.dismiss();
                            }
                        }).show();

    }
}

Related Tutorials