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.text.Html;

public class Main {
    public static void showErrorMessage(Context _context, String message) {
        showMessage(_context, "Error!", message, android.R.drawable.ic_dialog_alert, null);
    }

    public static void showMessage(Context _context, String title, String message, int icon,
            DialogInterface.OnClickListener ackHandler) {
        try {
            AlertDialog.Builder builder = new AlertDialog.Builder(_context);
            builder.setTitle(title);
            builder.setMessage(Html.fromHtml(message));
            builder.setCancelable(false);
            builder.setPositiveButton("Acknowledged", ackHandler);
            builder.setIcon(icon);
            builder.show();
        } catch (Exception e) {
        }
    }
}