List of usage examples for android.app AlertDialog.Builder show
public void show()
From source file:Main.java
public static void showMessage(Context _context, String title, String message, int icon, DialogInterface.OnClickListener ackHandler) { AlertDialog.Builder builder = new AlertDialog.Builder(_context); builder.setTitle(title);/*w w w. ja v a 2 s .co m*/ builder.setMessage(Html.fromHtml(message)); builder.setCancelable(false); builder.setPositiveButton("Acknowledged", ackHandler); builder.setIcon(icon); boolean show = true; if (_context instanceof Activity) { Activity activity = (Activity) _context; if (activity.isFinishing()) { show = false; } } if (show) builder.show(); }
From source file:Main.java
public static void getRingtonesDialog(Activity activity, Collection<String> items, int selected, DialogInterface.OnClickListener itemClickListener, DialogInterface.OnClickListener okClickListener, final DialogInterface.OnClickListener cancelClickListener) { AlertDialog.Builder builderSingle = new AlertDialog.Builder(activity); builderSingle.setTitle("Select Ringtone"); final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(activity, android.R.layout.select_dialog_singlechoice); arrayAdapter.addAll(items);/*from ww w . j ava 2s . c om*/ builderSingle.setNegativeButton(android.R.string.cancel, cancelClickListener); builderSingle.setPositiveButton(android.R.string.ok, okClickListener); builderSingle.setSingleChoiceItems(arrayAdapter, selected, itemClickListener); builderSingle.setCancelable(false); builderSingle.show(); }
From source file:Main.java
public static void showYesNoPrompt(Context _context, String title, String message, OnClickListener onYesListener, OnClickListener onNoListener) { AlertDialog.Builder builder = new AlertDialog.Builder(_context); builder.setTitle(title);/*from w ww .j ava 2s. c o m*/ builder.setIcon(android.R.drawable.ic_dialog_info); builder.setMessage(message); builder.setCancelable(false); builder.setPositiveButton("Yes", onYesListener); builder.setNegativeButton("No", onNoListener); boolean show = true; if (_context instanceof Activity) { Activity activity = (Activity) _context; if (activity.isFinishing()) { show = false; } } if (show) builder.show(); }
From source file:com.todotxt.todotxttouch.util.Util.java
public static void showDialog(Context cxt, int titleid, String msg) { AlertDialog.Builder builder = new AlertDialog.Builder(cxt); builder.setTitle(titleid);/*from w w w. j a v a 2s . c om*/ builder.setMessage(msg); builder.setPositiveButton(android.R.string.ok, null); builder.setCancelable(true); builder.show(); }
From source file:com.todotxt.todotxttouch.util.Util.java
public static void showDialog(Context cxt, int titleid, int msgid) { AlertDialog.Builder builder = new AlertDialog.Builder(cxt); builder.setTitle(titleid);//from w ww . j a v a2 s .c o m builder.setMessage(msgid); builder.setPositiveButton(android.R.string.ok, null); builder.setCancelable(true); builder.show(); }
From source file:com.doplgangr.secrecy.utils.Util.java
public static void alert(final Context context, final String title, final String message, final DialogInterface.OnClickListener positive, final DialogInterface.OnClickListener negative) { new Handler(Looper.getMainLooper()).post(new Runnable() { @Override/*from ww w . j av a2 s .c o m*/ public void run() { AlertDialog.Builder a = new AlertDialog.Builder(context); if (title != null) a.setTitle(title); if (message != null) a.setMessage(message); if (positive != null) a.setPositiveButton("OK", positive); if (negative != null) a.setNegativeButton("CANCEL", negative); a.setCancelable(false); a.show(); } }); }
From source file:com.evozi.droidsniff.helper.DialogHelper.java
public static void showDisclaimer(final Activity context) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setMessage(R.string.license); builder.setPositiveButton("Agree", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel();/*from w w w . jav a2 s . co m*/ } }).setNegativeButton("Disagree", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { context.finish(); } }); builder.setCancelable(false); builder.show(); }
From source file:com.doplgangr.secrecy.Util.java
public static void alert(final Context context, final String title, final String message, final DialogInterface.OnClickListener positive, final DialogInterface.OnClickListener negative) { new Handler(Looper.getMainLooper()).post(new Runnable() { @Override//from w w w . jav a2 s . c om public void run() { AlertDialog.Builder a = new AlertDialog.Builder(context); if (title != null) a.setTitle(title); if (message != null) a.setMessage(message); if (positive != null) a.setPositiveButton(context.getString(R.string.OK), positive); if (negative != null) a.setNegativeButton(context.getString(R.string.CANCEL), negative); a.setCancelable(false); a.show(); } }); }
From source file:com.todotxt.todotxttouch.util.Util.java
public static void showDeleteConfirmationDialog(Context cxt, OnClickListener oklistener) { AlertDialog.Builder builder = new AlertDialog.Builder(cxt); builder.setTitle(R.string.delete_task_title); builder.setMessage(R.string.delete_task_message); builder.setPositiveButton(R.string.delete_task_confirm, oklistener); builder.setNegativeButton(R.string.cancel, null); builder.show(); }
From source file:fi.mikuz.boarder.util.FileProcessor.java
private static void notify(final Activity activity, final String text) { activity.runOnUiThread(new Runnable() { public void run() { AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setMessage(text);//w ww . ja v a 2s.co m builder.show(); } }); }