Java tutorial
//package com.java2s; //License from project: Open Source License import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; public class Main { public static void showNfcSettingsDialog(final Activity app) { new AlertDialog.Builder(app).setTitle("NFC is disabled").setMessage("You must enable NFC to use this app.") .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { app.startActivity(new Intent(android.provider.Settings.ACTION_NFC_SETTINGS)); } }).setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { app.finish(); } }).setIcon(android.R.drawable.ic_dialog_alert).show(); } }