Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

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

public class Main {
    /**
     * Show a dialog that has one button - OK
     * @param context Context to grab string resources
     * @param titleRes String resource id to be put in the title
     * @param msgRes String resource id to be put in the message
     */
    public static void showOkDialog(Context context, int titleRes, int msgRes) {
        new AlertDialog.Builder(context).setTitle(context.getString(titleRes)).setMessage(context.getString(msgRes))
                .setNegativeButton(android.R.string.ok, (dialogInterface, i) -> dialogInterface.cancel()).show();
    }
}