List of usage examples for android.app AlertDialog.Builder setIcon
public void setIcon(Drawable icon)
From source file:net.evecom.android.log.DailyLogLookActivity.java
/** * fh//from w ww .j av a 2s.com * * @param v */ public void logfh(View v) { final AlertDialog.Builder builder = new AlertDialog.Builder(DailyLogLookActivity.this); builder.setTitle(""); builder.setIcon(R.drawable.qq_dialog_default_icon);// builder.setMessage(""); builder.setPositiveButton("", new DialogInterface.OnClickListener() { // @Override public void onClick(DialogInterface dialog, int which) { DailyLogLookActivity.this.finish(); Intent intent = new Intent(getApplicationContext(), DailyLogListActivity.class); startActivity(intent); } }); builder.setNegativeButton("", new DialogInterface.OnClickListener() { // @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.show(); }
From source file:br.com.GUI.perfil.SelecionarTipoDeLogin.java
public void loginComFacebook(View v) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(this); alertDialog.setTitle("Selecione seu tipo de Perfil"); alertDialog.setMessage(/* ww w . j a va2s.c o m*/ "O WorkUp util tanto para treinadores quanto para alunos, por favor, \nselecione abaixo qual o tipo de perfil que voc deseja criar."); alertDialog.setIcon(R.drawable.profile); alertDialog.setPositiveButton("Treinador", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { whatTypeIs = "personal"; loginComFacebook(); } }); alertDialog.setNegativeButton("Aluno", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { whatTypeIs = "aluno"; loginComFacebook(); } }); // Showing Alert Message alertDialog.show(); }
From source file:net.evecom.androidecssp.base.BaseActivity.java
/** * //from w w w. j a v a 2 s. c o m * * @param errorMsg */ protected void dialogToastNoCall(String errorMsg) { AlertDialog.Builder builder1 = new AlertDialog.Builder(this); builder1.setTitle(""); builder1.setIcon(R.drawable.qq_dialog_default_icon);// builder1.setMessage("" + errorMsg); builder1.setPositiveButton("", new DialogInterface.OnClickListener() { // @Override public void onClick(DialogInterface dialog, int which) { } }); builder1.show(); }
From source file:r2b.apps.view.base.BaseDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { iconRes = getArguments().getInt(ICON_RES_KEY, 0); title = getArguments().getString(TITLE_KEY); text = getArguments().getString(TEXT_KEY); isCancelable = getArguments().getBoolean(IS_CANCELABLE_KEY, true); customTitleViewRes = getArguments().getInt(CUSTOM_TITLE_VIEW_RES_KEY, 0); viewRes = getArguments().getInt(VIEW_RES_KEY, 0); positiveButonTextRes = getArguments().getInt(POSITIVE_BUTTON_TEXT_RES, 0); negativeButonTextRes = getArguments().getInt(NEGATIVE_BUTTON_TEXT_RES, 0); neutralButonTextRes = getArguments().getInt(NEUTRAL_BUTTON_TEXT_RES, 0); listArrayRes = getArguments().getInt(LIST_ARRAY_RES, 0); singleChoiceListArrayRes = getArguments().getInt(SINGLE_CHOICE_LIST_ARRAY_RES, 0); singleChoiceDefaultSelected = getArguments().getInt(SINGLE_CHOICE_DEFAULT_SELECTED, -1); multiChoiceListArrayRes = getArguments().getInt(MULTI_CHOICE_LIST_ARRAY_RES, 0); multiChoiceDefaultSelected = getArguments().getBooleanArray(MULTI_CHOICE_DEFAULT_SELECTED); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); final ArrayList<Integer> selectedItems = new ArrayList<Integer>(); // Get the layout inflater LayoutInflater inflater = getActivity().getLayoutInflater(); if (iconRes != 0) { builder.setIcon(iconRes); }//from w w w . j a v a 2s . c o m if (title != null) { builder.setTitle(title); } if (text != null && multiChoiceListArrayRes == 0 && singleChoiceListArrayRes == 0 && listArrayRes == 0) { builder.setMessage(text); } builder.setCancelable(isCancelable); if (customTitleViewRes != 0) { builder.setCustomTitle(inflater.inflate(customTitleViewRes, null)); // TODO NULL OR this, activity?? } if (viewRes != 0) { // Inflate and set the layout for the dialog // Pass null as the parent view because its going in the dialog layout builder.setView(inflater.inflate(viewRes, null)); } if (positiveButonTextRes != 0) { builder.setPositiveButton(positiveButonTextRes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { if (multiChoiceListArrayRes == 0) { // Send the positive button event back to the host activity dialogListener.onDialogPositiveClick(BaseDialog.this); } else { // Send the positive items selected to the host activity dialogListener.onSelectedItems(BaseDialog.this, selectedItems); } } }); } if (negativeButonTextRes != 0) { builder.setNegativeButton(negativeButonTextRes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { // Send the negative button event back to the host activity dialogListener.onDialogNegativeClick(BaseDialog.this); } }); } if (neutralButonTextRes != 0) { builder.setNeutralButton(neutralButonTextRes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { // Send the neutral button event back to the host activity dialogListener.onDialogNeutralClick(BaseDialog.this); } }); } if (listArrayRes != 0) { builder.setItems(listArrayRes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // The 'which' argument contains the index position of the selected item dialogListener.onItemClick(BaseDialog.this, which); } }); } if (singleChoiceListArrayRes != 0) { // Specify the list array, the items to be selected by default (-1 for none), // and the listener through which to receive callbacks when item is selected builder.setSingleChoiceItems(singleChoiceListArrayRes, singleChoiceDefaultSelected, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // The 'which' argument contains the index position of the selected item dialogListener.onItemClick(BaseDialog.this, which); } }); } if (multiChoiceListArrayRes != 0) { // Specify the list array, the items to be selected by default (null for none), // and the listener through which to receive callbacks when items are selected builder.setMultiChoiceItems(multiChoiceListArrayRes, multiChoiceDefaultSelected, new DialogInterface.OnMultiChoiceClickListener() { @Override public void onClick(DialogInterface dialog, int which, boolean isChecked) { if (isChecked) { // If the user checked the item, add it to the selected items selectedItems.add(which); } else if (selectedItems.contains(which)) { // Else, if the item is already in the array, remove it selectedItems.remove(Integer.valueOf(which)); } } }); } return builder.create(); }
From source file:net.evecom.androidecssp.base.BaseActivity.java
/** * /*w w w.j a v a2 s .co m*/ * * @param errorMsg */ protected void dialogToast(String errorMsg, final ICallback callback) { AlertDialog.Builder builder1 = new AlertDialog.Builder(this); builder1.setTitle(""); builder1.setIcon(R.drawable.qq_dialog_default_icon);// builder1.setMessage("" + errorMsg); builder1.setPositiveButton("", new DialogInterface.OnClickListener() { // @Override public void onClick(DialogInterface dialog, int which) { if (null != callback) { callback.execute(); } } }); builder1.show(); }
From source file:fr.pasteque.client.Configure.java
@Override public boolean onPreferenceChange(Preference preference, Object newValue) { if (preference.getKey().equals("printer_driver")) { // On printer driver update, change models if (newValue.equals("EPSON ePOS") && !Compat.isEpsonPrinterCompatible()) { Toast t = Toast.makeText(this, R.string.not_compatible, Toast.LENGTH_SHORT); t.show();/*from w w w .j a va 2 s . c o m*/ return false; } else if ((newValue.equals("LK-PXX") && !Compat.isLKPXXPrinterCompatible()) || (newValue.equals("Woosim") && !Compat.isWoosimPrinterCompatible())) { Toast t = Toast.makeText(this, R.string.not_compatible, Toast.LENGTH_SHORT); t.show(); return false; } this.updatePrinterPrefs(newValue); } else if ("card_processor".equals(preference.getKey())) { if ("payleven".equals(newValue) && !Compat.hasPaylevenApp(this)) { // Trying to enable payleven without app: download AlertDialog.Builder b = new AlertDialog.Builder(this); b.setTitle(R.string.config_payleven_download_title); b.setMessage(R.string.config_payleven_download_message); b.setIcon(android.R.drawable.ic_dialog_info); b.setNegativeButton(android.R.string.cancel, null); b.setPositiveButton(R.string.config_payleven_download_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=de.payleven.androidphone")); Configure.this.startActivity(i); } }); b.show(); return false; } this.updateCardProcessorPreferences((String) newValue); } return true; }
From source file:net.evecom.androidecssp.base.BaseActivity.java
/** * //from ww w.ja v a 2 s .co m * * @param errorMsg */ protected void dialogPickToast(String title, String msg, String ymsg, String nmsg, final IPickCallback callback) { AlertDialog.Builder builder1 = new AlertDialog.Builder(this); builder1.setTitle(title); builder1.setIcon(R.drawable.qq_dialog_default_icon);// builder1.setMessage(msg); builder1.setPositiveButton(ymsg, new DialogInterface.OnClickListener() { // @Override public void onClick(DialogInterface dialog, int which) { if (null != callback) { callback.yes(); } } }); builder1.setNegativeButton(nmsg, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { callback.no(); } }); builder1.show(); }
From source file:tr.com.turkcellteknoloji.turkcellupdater.UpdaterDialogManager.java
@Override public void onUpdateFailed(Exception exception) { Log.e("update check failed", exception); if (updateProgressDialog != null) { updateProgressDialog.dismiss();/* w ww .j a v a 2s. c om*/ } AlertDialog.Builder builder = new Builder(activity); builder.setIcon(android.R.drawable.ic_dialog_alert); builder.setTitle(R.string.error_occured); builder.setMessage(R.string.update_couldn_t_be_completed); builder.setCancelable(false); if (update == null || !update.forceUpdate) { builder.setNeutralButton(R.string.continue_, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { onCompleted(); } }); } else { builder.setNeutralButton(R.string.exit_application, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { onExit(); } }); } builder.create().show(); }
From source file:com.google.zxing.client.android.result.ResultHandler.java
final void openGoogleShopper(String query) { // Construct Intent to launch Shopper Intent intent = new Intent(Intent.ACTION_SEARCH); intent.setClassName(GOOGLE_SHOPPER_PACKAGE, GOOGLE_SHOPPER_ACTIVITY); intent.putExtra(SearchManager.QUERY, query); // Is it available? PackageManager pm = activity.getPackageManager(); Collection<?> availableApps = pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); if (availableApps != null && !availableApps.isEmpty()) { // If something can handle it, start it activity.startActivity(intent);/*w ww .j a v a 2 s . c o m*/ } else { // Otherwise offer to install it from Market. AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(R.string.msg_google_shopper_missing); builder.setMessage(R.string.msg_install_google_shopper); builder.setIcon(R.drawable.shopper_icon); builder.setPositiveButton(R.string.button_ok, shopperMarketListener); builder.setNegativeButton(R.string.button_cancel, null); builder.show(); } }
From source file:com.orangelabs.rcs.ri.extension.messaging.MessagingSessionView.java
private void initialiseMessagingSession(Intent intent) { MultimediaSessionService sessionApi = mCnxManager.getMultimediaSessionApi(); try {/*from ww w .java 2s .c o m*/ MultimediaSessionServiceConfiguration config = sessionApi.getConfiguration(); if (LogUtils.isActive) { Log.d(LOGTAG, "MessageMaxLength: ".concat(Integer.toString(config.getMessageMaxLength()))); } int mode = intent.getIntExtra(MessagingSessionView.EXTRA_MODE, -1); if (mode == MessagingSessionView.MODE_OUTGOING) { // Outgoing session // Check if the service is available if (!sessionApi.isServiceRegistered()) { Utils.showMessageAndExit(this, getString(R.string.label_service_not_available), mExitOnce); return; } // Get remote contact mContact = intent.getParcelableExtra(MessagingSessionView.EXTRA_CONTACT); // Initiate session startSession(); } else if (mode == MessagingSessionView.MODE_OPEN) { // Open an existing session // Incoming session mSessionId = intent.getStringExtra(MessagingSessionView.EXTRA_SESSION_ID); // Get the session mSession = sessionApi.getMessagingSession(mSessionId); if (mSession == null) { // Session not found or expired Utils.showMessageAndExit(this, getString(R.string.label_session_has_expired), mExitOnce); return; } // Get remote contact mContact = mSession.getRemoteContact(); } else { // Incoming session from its Intent mSessionId = intent.getStringExtra(MultimediaMessagingSessionIntent.EXTRA_SESSION_ID); // Get the session mSession = sessionApi.getMessagingSession(mSessionId); if (mSession == null) { // Session not found or expired Utils.showMessageAndExit(this, getString(R.string.label_session_has_expired), mExitOnce); return; } // Get remote contact mContact = mSession.getRemoteContact(); String from = RcsDisplayName.getInstance(this).getDisplayName(mContact); // Manual accept AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.title_messaging_session); builder.setMessage(getString(R.string.label_mm_from_id, from, mServiceId)); builder.setCancelable(false); builder.setIcon(R.drawable.ri_notif_mm_session_icon); builder.setPositiveButton(getString(R.string.label_accept), acceptBtnListener); builder.setNegativeButton(getString(R.string.label_decline), declineBtnListener); builder.show(); } // Display session info TextView featureTagEdit = (TextView) findViewById(R.id.feature_tag); featureTagEdit.setText(mServiceId); String from = RcsDisplayName.getInstance(this).getDisplayName(mContact); TextView contactEdit = (TextView) findViewById(R.id.contact); contactEdit.setText(from); Button sendBtn = (Button) findViewById(R.id.send_btn); if (mSession != null) { sendBtn.setEnabled(true); } else { sendBtn.setEnabled(false); } } catch (RcsServiceException e) { Utils.showMessageAndExit(this, getString(R.string.label_api_failed), mExitOnce, e); } }