Show Error Alert Dialog - Android User Interface

Android examples for User Interface:Alert Dialog

Description

Show Error Alert Dialog

Demo Code


//package com.java2s;

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

public class Main {
    public static void ShowErrorAlert(Context context, String heading,
            String description) {
        new AlertDialog.Builder(context)
                .setTitle(heading)/*ww  w.  j a v  a 2  s  . c  o  m*/
                .setMessage(description)
                .setPositiveButton(android.R.string.no,
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog,
                                    int which) {
                                // do nothing
                            }
                        }).setIcon(android.R.drawable.ic_dialog_alert)
                .show();
    }
}

Related Tutorials