Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.app.Activity;
import android.app.AlertDialog;

import android.content.DialogInterface;

public class Main {
    public static void alertActivityFinish(final Activity activity, String msg) {
        AlertDialog.Builder ad = new AlertDialog.Builder(activity);
        ad.setIcon(activity.getResources().getDrawable(android.R.drawable.ic_dialog_alert)); // Android Resource
        ad.setTitle("Sky Canvas").setMessage(msg).setPositiveButton("OK", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                // finish dialog
                dialog.dismiss();
                activity.finish();
            }
        }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {

            }
        }).show();
        ad = null;
    }
}