List of usage examples for android.app AlertDialog.Builder setIcon
public void setIcon(Drawable icon)
From source file:eu.funceptionapps.convertitall.ui.ConverterInterface.java
public static void makeUpdateDialog() { AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(thisContext); dialogBuilder.setCancelable(true);//from w w w .j ava 2s.c om dialogBuilder.setTitle(thisContext.getString(R.string.title_update_dialog)); dialogBuilder.setMessage(thisContext.getString(R.string.msg_update_dialog)); dialogBuilder.setIcon(R.drawable.ic_dialog_alert_holo_light); dialogBuilder.setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { try { Currency.updateCurrencies(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } }); dialogBuilder.setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); AlertDialog alertInternetConnection = dialogBuilder.create(); alertInternetConnection.show(); }
From source file:dentex.youtube.downloader.utils.Utils.java
public static void offerDevMail(final Context ctx) { AlertDialog.Builder adb = new AlertDialog.Builder(ctx); adb.setIcon(Utils.selectThemedAlertIcon()); adb.setTitle(ctx.getString(R.string.ffmpeg_device_not_supported)); adb.setMessage(ctx.getString(R.string.ffmpeg_support_mail)); adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { /*// w w w.j ava 2s.c o m * adapted form same source as createEmailOnlyChooserIntent below */ Intent i = new Intent(Intent.ACTION_SEND); i.setType("*/*"); String content = Utils.getCpuInfo(); /*File destDir = getActivity().getExternalFilesDir(null); String filename = "cpuInfo.txt"; try { Utils.createLogFile(destDir, filename, content); i.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(destDir, filename)));*/ i.putExtra(Intent.EXTRA_EMAIL, new String[] { "samuele.rini76@gmail.com" }); i.putExtra(Intent.EXTRA_SUBJECT, "YTD: device info report"); i.putExtra(Intent.EXTRA_TEXT, content); ctx.startActivity(createEmailOnlyChooserIntent(ctx, i, ctx.getString(R.string.email_via))); /*} catch (IOException e) { Log.e(DEBUG_TAG, "IOException on creating cpuInfo Log file ", e); }*/ } }); adb.setNegativeButton(ctx.getString(R.string.dialogs_negative), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // cancel } }); AlertDialog helpDialog = adb.create(); if (!((Activity) ctx).isFinishing()) { helpDialog.show(); } }
From source file:org.dkf.jmule.util.UIUtils.java
public static void showYesNoDialog(Context context, int iconId, String message, int titleId, List<String> bullets, OnClickListener positiveListener, OnClickListener negativeListener, AdapterView.OnItemClickListener bulletsClickListener) { if (bullets == null || bullets.isEmpty()) { LOG.warn("showYesNoDialog() - aborting bullet dialog, no bullets to show."); return;/*from w ww .j av a 2 s. c om*/ } AlertDialog.Builder builder = new AlertDialog.Builder(context); // show all bullets pre-checked, prepend for (int i = 0; i < bullets.size(); i++) { bullets.set(i, String.valueOf(Html.fromHtml("• " + bullets.get(i)))); } ArrayAdapter bulletsAdapter; bulletsAdapter = new ArrayAdapter(context, R.layout.dialog_update_bullet, R.id.dialog_update_bullets_checked_text_view, bullets); ListView bulletsListView = new ListView(context); bulletsListView.setAdapter(bulletsAdapter); bulletsListView.setOnItemClickListener(bulletsClickListener); builder.setIcon(iconId).setTitle(titleId).setMessage(message).setView(bulletsListView).setCancelable(false) .setPositiveButton(android.R.string.yes, positiveListener) .setNegativeButton(android.R.string.no, negativeListener).create().show(); }
From source file:org.thialfihar.android.apg.ui.dialog.BadImportKeyDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { final FragmentActivity activity = getActivity(); final int badImport = getArguments().getInt(ARG_BAD_IMPORT); AlertDialog.Builder alert = new AlertDialog.Builder(activity); alert.setIcon(R.drawable.ic_dialog_alert_holo_light); alert.setTitle(R.string.warning);//from w ww. j av a 2s .c o m alert.setMessage( activity.getResources().getQuantityString(R.plurals.bad_keys_encountered, badImport, badImport)); alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); alert.setCancelable(true); return alert.create(); }
From source file:com.dimasdanz.kendalipintu.util.UniversalDialogManager.java
public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), 4); builder.setIcon(android.R.drawable.ic_dialog_info); builder.setTitle(R.string.string_confirmation); builder.setMessage(R.string.string_are_you_sure); builder.setPositiveButton(R.string.apply, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { mListener.onDialogPositiveClick(UniversalDialogManager.this); }//from w w w . ja v a 2s . c o m }); builder.setNeutralButton(R.string.close, null); return builder.create(); }
From source file:com.example.tahsi.challenge.InfoDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity()); alertDialogBuilder.setIcon(R.drawable.goal); alertDialogBuilder.setTitle("Need Help? Ask these questions to get started"); alertDialogBuilder.setItems(R.array.Questions, new DialogInterface.OnClickListener() { @Override// ww w . j a v a2 s .c o m public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); } }); return alertDialogBuilder.create(); }
From source file:com.snippet.widget.AlertDialogFragment.java
@Override public Dialog onCreateDialog(final Bundle savedInstanceState) { Bundle args = getArguments();/*from w w w . ja v a 2 s . c o m*/ int icon = args.getInt(ARG_ICON); String title = args.getString(ARG_TITLE); String message = args.getString(ARG_MESSAGE); boolean cancelable = args.getBoolean(ARG_CANCELABLE, true); setCancelable(cancelable); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); if (icon != 0) { builder.setIcon(android.R.drawable.ic_dialog_info); } if (!TextUtils.isEmpty(title)) { builder.setTitle(title); } builder.setMessage(message); builder.setPositiveButton(android.R.string.ok, null); Dialog dialog = builder.create(); dialog.setCanceledOnTouchOutside(cancelable); return dialog; }
From source file:com.darizotas.metadatastrip.FileListActivity.java
/** * Callback method from {@link FileListFragment.Callbacks} indicating that * the item with the given PATH was selected. *///from w w w . java 2 s . c om @Override public void onItemSelected(String path) { File file = new File(path); if (file.canRead()) { if (file.isDirectory()) { FragmentManager manager = getSupportFragmentManager(); if (mTwoPane) { // Removes the previous detail fragment Fragment fragment = manager.findFragmentById(R.id.file_detail_container); if (fragment != null) { manager.beginTransaction().remove(fragment).commit(); //http://stackoverflow.com/questions/7246479/android-fragmenttransaction-commit-when manager.executePendingTransactions(); } } // Updates the list. ((FileListFragment) manager.findFragmentById(R.id.file_list)).updateListAdapter(file.getPath()); } else { showDetails(path); } // The folder cannot be read. } else { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setIcon(R.drawable.ic_launcher) .setTitle("[" + file.getName() + "] " + getResources().getText(R.string.error_open_file)) .setPositiveButton("OK", null).show(); } }
From source file:siarhei.luskanau.gps.tracker.free.ui.dialog.AboutFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.fragment_left_drawer_about); builder.setIcon(R.drawable.ic_action_about); try {// ww w . j a va 2 s.c o m String message = new String(Utils.getBytes(getResources().openRawResource(R.raw.about)), "utf-8"); builder.setMessage(Html.fromHtml(message)); } catch (Throwable t1) { builder.setMessage(null); } builder.setNeutralButton(android.R.string.ok, null); return builder.create(); }
From source file:com.techjoynt.android.nxt.fragment.dialog.DeviceSwitchFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.choose_device_type); builder.setIcon(R.drawable.ic_action_info); builder.setSingleChoiceItems(R.array.robots_array, mPrefs.getInt(PrefFragment.KEY_PREF_SELECTED_DEVICE, -1), new DialogInterface.OnClickListener() { @Override/*from www. ja va 2 s .c o m*/ public void onClick(DialogInterface dialog, int which) { String robotNames[] = getResources().getStringArray(R.array.robots_array); selectedDeviceType = robotNames[which].toString(); editor.putInt(PrefFragment.KEY_PREF_SELECTED_DEVICE, which).commit(); mListener.onDeviceSelectedChanged(selectedDeviceType); getDialog().dismiss(); } }); return builder.create(); }