List of usage examples for android.app AlertDialog.Builder setIcon
public void setIcon(Drawable icon)
From source file:br.ufg.inf.es.fs.contpatri.mobile.webservice.Autenticar.java
/** * Mtodo que exibe um <code>Dialog</code> caso haja erro no login do * usurio no aplicativo./*from w w w .j a v a 2 s .co m*/ * * @param contexto * <code>Context</code> necessrio para criar e exibir a caixa de * dilogo. * @param mensagem * mensagem de erro que ser exibida na <code>Dialog</code> para * informar o motivo de a aplicao no realizar o login * corretamente */ public static void mostrarDialogo(final Context contexto, final String mensagem) { AlertDialog.Builder builder; builder = new AlertDialog.Builder(contexto); builder.setTitle("Erro"); builder.setMessage(mensagem); builder.setIcon(android.R.drawable.ic_dialog_alert); builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { dialog.dismiss(); } }); final AlertDialog dialog = builder.create(); dialog.setCanceledOnTouchOutside(true); dialog.show(); }
From source file:com.marcopolci.paperwalletvalidator.MainActivity.java
private static DialogFragment createCameraProblemdDialog() { return new DialogFragment() { @Override/* w w w . j a va 2 s . c o m*/ public Dialog onCreateDialog(Bundle savedInstanceState) { final AlertDialog.Builder dialog = new AlertDialog.Builder(getActivity()); dialog.setIcon(R.drawable.ic_menu_warning); dialog.setTitle(R.string.scan_camera_problem_dialog_title); dialog.setMessage(R.string.scan_camera_problem_dialog_message); dialog.setNeutralButton(R.string.button_dismiss, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { dialog.dismiss(); } }); dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(final DialogInterface dialog) { dialog.dismiss(); } }); return dialog.create(); } }; }
From source file:Main.java
public static AlertDialog newMessageDialog(final Activity activity, String dialogTitle, String screenMessage, int iconResourceId) { AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setCancelable(false);//from w w w .j av a 2 s . c o m builder.setPositiveButton("Okay", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.setTitle(dialogTitle); builder.setMessage(screenMessage); builder.setIcon(iconResourceId); return builder.create(); }
From source file:Main.java
/** * Creates a new AlertDialog to display a simple message * // w ww .j a va2 s .c om * @param context * @param dialogTitle * @param screenMessage * @param iconResourceId * @return */ public static AlertDialog newMessageDialog(final Context context, String dialogTitle, String screenMessage, int iconResourceId) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setCancelable(false); builder.setPositiveButton("Okay", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.setTitle(dialogTitle); builder.setMessage(screenMessage); builder.setIcon(iconResourceId); return builder.create(); }
From source file:Main.java
public static AlertDialog newMessageDialog(Context context, String s, String s1, int i) { android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(context); builder.setCancelable(false);//from w w w .j a va2 s . c o m builder.setPositiveButton("Okay", new android.content.DialogInterface.OnClickListener() { public void onClick(DialogInterface dialoginterface, int j) { dialoginterface.dismiss(); } }); builder.setTitle(s); builder.setMessage(s1); builder.setIcon(i); return builder.create(); }
From source file:com.escabe.TraktApi.java
public static boolean Login(String u, String p) { username = u;/*ww w .j av a 2 s .com*/ password = p; JSONObject data = getDataObjectFromJSON("", true); if (data == null) { AlertDialog.Builder alert = new AlertDialog.Builder(trakt.instance); alert.setTitle("Trakt.tv"); alert.setMessage("Login Failed!\nPlease check login details."); alert.setIcon(android.R.drawable.ic_dialog_alert); alert.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { trakt.instance.myflipper.FlipTo(MyView.SETTINGS); } }); alert.show(); return false; } else { return true; } }
From source file:com.bt.download.android.gui.util.UIUtils.java
public static void showYesNoDialog(Context context, int iconId, int messageId, int titleId, OnClickListener positiveListener, OnClickListener negativeListener) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setIcon(iconId).setMessage(messageId).setTitle(titleId).setCancelable(false) .setPositiveButton(android.R.string.yes, positiveListener) .setNegativeButton(android.R.string.no, negativeListener); builder.create().show();/*from www . j a v a 2s . c om*/ }
From source file:com.bt.download.android.gui.util.UIUtils.java
public static void showYesNoDialog(Context context, int iconId, String message, int titleId, OnClickListener positiveListener, OnClickListener negativeListener) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setIcon(iconId).setMessage(message).setTitle(titleId).setCancelable(false) .setPositiveButton(android.R.string.yes, positiveListener) .setNegativeButton(android.R.string.no, negativeListener); builder.create().show();//from ww w .j av a 2 s . co m }
From source file:org.dkf.jmule.util.UIUtils.java
public static void showYesNoDialog(Context context, int iconId, String message, int titleId, OnClickListener positiveListener, OnClickListener negativeListener) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setIcon(iconId).setMessage(message).setTitle(titleId).setCancelable(false) .setPositiveButton(android.R.string.yes, positiveListener) .setNegativeButton(android.R.string.no, negativeListener); builder.create().show();/*from ww w. ja v a 2 s. c om*/ }
From source file:nl.mpcjanssen.simpletask.util.Util.java
public static Dialog createSingleChoiceDialog(Context cxt, CharSequence[] keys, String[] values, int selected, Integer titleId, Integer iconId, final OnSingleChoiceDialogListener listener) { assert (values.length == keys.length); AlertDialog.Builder builder = new AlertDialog.Builder(cxt); if (iconId != null) { builder.setIcon(iconId); }//from w w w. java 2s . c om if (titleId != null) { builder.setTitle(titleId); } final String[] res = values; final int checkedItem = selected; builder.setSingleChoiceItems(keys, checkedItem, null); builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { int index = ((AlertDialog) dialog).getListView().getCheckedItemPosition(); listener.onClick(res[index]); } }); builder.setNegativeButton(R.string.cancel, null); return builder.create(); }