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;
import android.content.DialogInterface;

public class Main {
    /**
     * Show a yes/no dialog, providing the yes listener function
     */
    public static void showYesNoDialog(Context context, int titleRes, int msgRes,
            DialogInterface.OnClickListener posListener) {
        new AlertDialog.Builder(context).setTitle(context.getString(titleRes)).setMessage(context.getString(msgRes))
                .setNegativeButton(android.R.string.no, (dialogInterface, i) -> dialogInterface.cancel())
                .setPositiveButton(android.R.string.yes, posListener).show();
    }
}