Java Code Examples for android.app.AlertDialog.Builder#setIcon()
The following examples show how to use
android.app.AlertDialog.Builder#setIcon() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Main.java From screenstandby with GNU General Public License v2.0 | 8 votes |
private void openVideoClip() { Builder watchDialog = new AlertDialog.Builder(this).setCancelable(true); watchDialog.setTitle("Select a video clip:"); watchDialog.setIcon(android.R.drawable.ic_menu_slideshow); watchDialog.setItems(clipsName, new android.content.DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (which >= 0) { Intent youtubeIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=" + clipsUrl[which])); youtubeIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); startActivity(youtubeIntent); } }}); watchDialog.setNegativeButton("Dismiss", null); watchDialog.show(); }
Example 2
Source File: MMAlert.java From wechatsdk-xamarin with Apache License 2.0 | 6 votes |
public static AlertDialog showAlert(final Context context, final String msg, final String title, final String yes, final String no, final DialogInterface.OnClickListener lOk, final DialogInterface.OnClickListener lCancel) { if (context instanceof Activity && ((Activity) context).isFinishing()) { return null; } final Builder builder = new AlertDialog.Builder(context); builder.setIcon(R.drawable.ic_dialog_alert); builder.setTitle(title); builder.setMessage(msg); builder.setPositiveButton(yes, lOk); builder.setNegativeButton(no, lCancel); // builder.setCancelable(false); final AlertDialog alert = builder.create(); alert.show(); return alert; }
Example 3
Source File: MMAlert.java From wechatsdk-xamarin with Apache License 2.0 | 6 votes |
public static AlertDialog showAlert(final Context context, final String msg, final String title, final DialogInterface.OnClickListener lOk, final DialogInterface.OnClickListener lCancel) { if (context instanceof Activity && ((Activity) context).isFinishing()) { return null; } final Builder builder = new AlertDialog.Builder(context); builder.setIcon(R.drawable.ic_dialog_alert); builder.setTitle(title); builder.setMessage(msg); builder.setPositiveButton(R.string.app_ok, lOk); builder.setNegativeButton(R.string.app_cancel, lCancel); // builder.setCancelable(false); final AlertDialog alert = builder.create(); alert.show(); return alert; }
Example 4
Source File: MMAlert.java From wechatsdk-xamarin with Apache License 2.0 | 6 votes |
public static AlertDialog showAlert(final Context context, final String msg, final String title) { if (context instanceof Activity && ((Activity) context).isFinishing()) { return null; } final Builder builder = new AlertDialog.Builder(context); builder.setIcon(R.drawable.ic_dialog_alert); builder.setTitle(title); builder.setMessage(msg); builder.setPositiveButton(R.string.app_ok, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { dialog.cancel(); } }); final AlertDialog alert = builder.create(); alert.show(); return alert; }
Example 5
Source File: MMAlert.java From wechatsdk-xamarin with Apache License 2.0 | 6 votes |
public static AlertDialog showAlert(final Context context, final int msgId, final int titleId) { if (context instanceof Activity && ((Activity) context).isFinishing()) { return null; } final Builder builder = new AlertDialog.Builder(context); builder.setIcon(R.drawable.ic_dialog_alert); builder.setTitle(titleId); builder.setMessage(msgId); builder.setPositiveButton(R.string.app_ok, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { dialog.cancel(); } }); final AlertDialog alert = builder.create(); alert.show(); return alert; }
Example 6
Source File: MMAlert.java From wechatsdk-xamarin with Apache License 2.0 | 6 votes |
public static AlertDialog showAlert(final Context context, final int msg, final int title, final int yes, final int no, final DialogInterface.OnClickListener lOk, final DialogInterface.OnClickListener lCancel) { if (context instanceof Activity && ((Activity) context).isFinishing()) { return null; } final Builder builder = new AlertDialog.Builder(context); builder.setIcon(R.drawable.ic_dialog_alert); builder.setTitle(title); builder.setMessage(msg); builder.setPositiveButton(yes, lOk); builder.setNegativeButton(no, lCancel); // builder.setCancelable(false); final AlertDialog alert = builder.create(); alert.show(); return alert; }
Example 7
Source File: MMAlert.java From wechatsdk-xamarin with Apache License 2.0 | 6 votes |
public static AlertDialog showAlert(final Context context, final int msgId, final int titleId, final DialogInterface.OnClickListener lOk, final DialogInterface.OnClickListener lCancel) { if (context instanceof Activity && ((Activity) context).isFinishing()) { return null; } final Builder builder = new AlertDialog.Builder(context); builder.setIcon(R.drawable.ic_dialog_alert); builder.setTitle(titleId); builder.setMessage(msgId); builder.setPositiveButton(R.string.app_ok, lOk); builder.setNegativeButton(R.string.app_cancel, lCancel); // builder.setCancelable(false); final AlertDialog alert = builder.create(); alert.show(); return alert; }
Example 8
Source File: SingleChoiceDialogFragment.java From barterli_android with Apache License 2.0 | 5 votes |
@Override public Dialog onCreateDialog(final Bundle savedInstanceState) { if (savedInstanceState != null) { mTitleId = savedInstanceState.getInt(DialogKeys.TITLE_ID); isCancellable = savedInstanceState .getBoolean(DialogKeys.CANCELLABLE); mIconId = savedInstanceState.getInt(DialogKeys.ICON_ID); mTheme = savedInstanceState.getInt(DialogKeys.THEME); mItemsId = savedInstanceState.getInt(DialogKeys.ITEMS_ID); } final Builder builder = new Builder(getActivity(), mTheme); if (mItemsId == 0) { throw new IllegalArgumentException("No items available to add"); } builder.setItems(mItemsId, mClickListener); if (mIconId != 0) { builder.setIcon(mIconId); } if (mTitleId != 0) { builder.setTitle(mTitleId); } builder.setCancelable(isCancellable); setCancelable(isCancellable); return builder.create(); }
Example 9
Source File: BaseHelper.java From letv with Apache License 2.0 | 5 votes |
public static void showDialog(Activity context, String strTitle, String strText, int icon) { if (context != null && !context.isFinishing() && !context.isRestricted()) { Builder tDialog = new Builder(context); tDialog.setIcon(icon); tDialog.setTitle(strTitle); tDialog.setMessage(strText); tDialog.setPositiveButton(R.string.Ensure, null); try { tDialog.show(); } catch (Exception e) { } } }
Example 10
Source File: MMAlert.java From wechatsdk-xamarin with Apache License 2.0 | 5 votes |
public static AlertDialog showAlert(final Context context, final String msg, final String title, final DialogInterface.OnClickListener l) { if (context instanceof Activity && ((Activity) context).isFinishing()) { return null; } final Builder builder = new AlertDialog.Builder(context); builder.setIcon(R.drawable.ic_dialog_alert); builder.setTitle(title); builder.setMessage(msg); builder.setPositiveButton(R.string.app_ok, l); // builder.setCancelable(false); final AlertDialog alert = builder.create(); alert.show(); return alert; }
Example 11
Source File: MMAlert.java From wechatsdk-xamarin with Apache License 2.0 | 5 votes |
public static AlertDialog showAlert(final Context context, final int msgId, final int titleId, final DialogInterface.OnClickListener l) { if (context instanceof Activity && ((Activity) context).isFinishing()) { return null; } final Builder builder = new AlertDialog.Builder(context); builder.setIcon(R.drawable.ic_dialog_alert); builder.setTitle(titleId); builder.setMessage(msgId); builder.setPositiveButton(R.string.app_ok, l); // builder.setCancelable(false); final AlertDialog alert = builder.create(); alert.show(); return alert; }
Example 12
Source File: ActivityDlgActionInput.java From LibreTasks with Apache License 2.0 | 5 votes |
public void onClick(View v) { Builder help = new AlertDialog.Builder(v.getContext()); help.setIcon(android.R.drawable.ic_menu_help); help.setTitle(R.string.help); help.setMessage(Html.fromHtml(getString(R.string.help_dlgactioninput))); help.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }); help.show(); }
Example 13
Source File: ActivityDlgFilterInput.java From LibreTasks with Apache License 2.0 | 5 votes |
public void onClick(View v) { Builder help = new AlertDialog.Builder(v.getContext()); help.setIcon(android.R.drawable.ic_menu_help); help.setTitle(R.string.help); help.setMessage(Html.fromHtml(getString(R.string.help_dlgfilterinput))); help.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }); help.show(); }
Example 14
Source File: ActivityMain.java From LibreTasks with Apache License 2.0 | 5 votes |
public void onClick(View v) { Builder help = new AlertDialog.Builder(v.getContext()); help.setTitle(R.string.help_title); help.setIcon(R.drawable.icon); help.setMessage(Html.fromHtml(getString(R.string.help_activitymain))); help.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }); help.show(); }
Example 15
Source File: ActivityMain.java From LibreTasks with Apache License 2.0 | 5 votes |
/** * Display our about dialog. */ private void showAbout() { // Get package information String version; try { PackageInfo pkgInfo; pkgInfo = getPackageManager().getPackageInfo(this.getPackageName(), 0); version = pkgInfo.versionName; } catch (NameNotFoundException e) { version = getString(R.string.unknown); } StringBuilder message = new StringBuilder(); message.append(getString(R.string.about_desc)).append("<br /><br />"); message.append(getString(R.string.copyright)).append("<br /><br />"); message.append(getString(R.string.about_version)).append(" ").append(version); message.append("<br /><br />"); message.append(getString(R.string.about_license)).append("<br /><br />"); message.append(getString(R.string.about_website)); Builder about = new AlertDialog.Builder(this); about.setTitle(R.string.about_title); about.setIcon(R.drawable.icon); about.setMessage(Html.fromHtml(message.toString())); about.setPositiveButton(R.string.ok, null); about.show(); }
Example 16
Source File: AddUserInfoDialogFragment.java From barterli_android with Apache License 2.0 | 4 votes |
@Override public Dialog onCreateDialog(final Bundle savedInstanceState) { if (savedInstanceState != null) { mTitleId = savedInstanceState.getInt(DialogKeys.TITLE_ID); mNegativeLabelId = savedInstanceState .getInt(DialogKeys.NEGATIVE_LABEL_ID); mNeutralLabelId = savedInstanceState .getInt(DialogKeys.NEUTRAL_LABEL_ID); mPositiveLabelId = savedInstanceState .getInt(DialogKeys.POSITIVE_LABEL_ID); isCancellable = savedInstanceState .getBoolean(DialogKeys.CANCELLABLE); mIconId = savedInstanceState.getInt(DialogKeys.ICON_ID); mTheme = savedInstanceState.getInt(DialogKeys.THEME); } final Builder builder = new Builder(getActivity(), mTheme); final View contentView = LayoutInflater.from(getActivity()) .inflate(R.layout.layout_dialog_names, null); mFirstNameEditText = (EditText) contentView .findViewById(R.id.edittext_first_name); mLastNameEditText = (EditText) contentView .findViewById(R.id.edittext_last_name); builder.setView(contentView); if (mIconId != 0) { builder.setIcon(mIconId); } if (mTitleId != 0) { builder.setTitle(mTitleId); } if (mPositiveLabelId != 0) { builder.setPositiveButton(mPositiveLabelId, mClickListener); } if (mNegativeLabelId != 0) { builder.setNegativeButton(mNegativeLabelId, mClickListener); } if (mNeutralLabelId != 0) { builder.setNeutralButton(mNeutralLabelId, mClickListener); } builder.setCancelable(isCancellable); setCancelable(isCancellable); return builder.create(); }
Example 17
Source File: AlertDialogFragment.java From barterli_android with Apache License 2.0 | 4 votes |
@Override public Dialog onCreateDialog(final Bundle savedInstanceState) { if (savedInstanceState != null) { mTitleId = savedInstanceState.getInt(DialogKeys.TITLE_ID); mMessageId = savedInstanceState.getInt(DialogKeys.MESSAGE_ID); mNegativeLabelId = savedInstanceState .getInt(DialogKeys.NEGATIVE_LABEL_ID); mNeutralLabelId = savedInstanceState .getInt(DialogKeys.NEUTRAL_LABEL_ID); mPositiveLabelId = savedInstanceState .getInt(DialogKeys.POSITIVE_LABEL_ID); isCancellable = savedInstanceState .getBoolean(DialogKeys.CANCELLABLE); mIconId = savedInstanceState.getInt(DialogKeys.ICON_ID); mTheme = savedInstanceState.getInt(DialogKeys.THEME); mMessageParams = savedInstanceState .getStringArray(DialogKeys.MESSAGE_PARAMS); } final Builder builder = new Builder(getActivity(), mTheme); if ((mTitleId == 0) && (mMessageId == 0)) { throw new IllegalArgumentException("No Title and no message"); } if (mIconId != 0) { builder.setIcon(mIconId); } if (mTitleId != 0) { builder.setTitle(mTitleId); } if (mMessageId != 0) { if ((mMessageParams != null) && (mMessageParams.length > 0)) { builder.setMessage(getActivity() .getString(mMessageId, (Object[]) mMessageParams)); } else { builder.setMessage(mMessageId); } } if (mPositiveLabelId != 0) { builder.setPositiveButton(mPositiveLabelId, mClickListener); } if (mNegativeLabelId != 0) { builder.setNegativeButton(mNegativeLabelId, mClickListener); } if (mNeutralLabelId != 0) { builder.setNeutralButton(mNeutralLabelId, mClickListener); } builder.setCancelable(isCancellable); setCancelable(isCancellable); return builder.create(); }
Example 18
Source File: AddSingleEditTextDialogFragment.java From barterli_android with Apache License 2.0 | 4 votes |
@Override public Dialog onCreateDialog(final Bundle savedInstanceState) { if (savedInstanceState != null) { mTitleId = savedInstanceState.getInt(DialogKeys.TITLE_ID); mNegativeLabelId = savedInstanceState .getInt(DialogKeys.NEGATIVE_LABEL_ID); mNeutralLabelId = savedInstanceState .getInt(DialogKeys.NEUTRAL_LABEL_ID); mPositiveLabelId = savedInstanceState .getInt(DialogKeys.POSITIVE_LABEL_ID); isCancellable = savedInstanceState .getBoolean(DialogKeys.CANCELLABLE); mIconId = savedInstanceState.getInt(DialogKeys.ICON_ID); mTheme = savedInstanceState.getInt(DialogKeys.THEME); } final Builder builder = new Builder(getActivity(), mTheme); final View contentView = LayoutInflater.from(getActivity()) .inflate(R.layout.layout_dialog_place, null); mNameEditText = (EditText) contentView .findViewById(R.id.edittext_location_name); if(mHintLabelId!=0) { mNameEditText.setHint(mHintLabelId); } builder.setView(contentView); if (mIconId != 0) { builder.setIcon(mIconId); } if (mTitleId != 0) { builder.setTitle(mTitleId); } if (mPositiveLabelId != 0) { builder.setPositiveButton(mPositiveLabelId, mClickListener); } if (mNegativeLabelId != 0) { builder.setNegativeButton(mNegativeLabelId, mClickListener); } if (mNeutralLabelId != 0) { builder.setNeutralButton(mNeutralLabelId, mClickListener); } builder.setCancelable(isCancellable); setCancelable(isCancellable); return builder.create(); }
Example 19
Source File: EnableLocationDialogFragment.java From barterli_android with Apache License 2.0 | 4 votes |
@Override public Dialog onCreateDialog(final Bundle savedInstanceState) { if (savedInstanceState != null) { mTitleId = savedInstanceState.getInt(DialogKeys.TITLE_ID); mMessageId = savedInstanceState.getInt(DialogKeys.MESSAGE_ID); mNegativeLabelId = savedInstanceState .getInt(DialogKeys.NEGATIVE_LABEL_ID); mNeutralLabelId = savedInstanceState .getInt(DialogKeys.NEUTRAL_LABEL_ID); mPositiveLabelId = savedInstanceState .getInt(DialogKeys.POSITIVE_LABEL_ID); isCancellable = savedInstanceState .getBoolean(DialogKeys.CANCELLABLE); mIconId = savedInstanceState.getInt(DialogKeys.ICON_ID); mTheme = savedInstanceState.getInt(DialogKeys.THEME); mMessageParams = savedInstanceState .getStringArray(DialogKeys.MESSAGE_PARAMS); } final Builder builder = new Builder(getActivity(), mTheme); if ((mTitleId == 0) && (mMessageId == 0)) { throw new IllegalArgumentException("No Title and no message"); } if (mMessageId != 0) { if ((mMessageParams != null) && (mMessageParams.length > 0)) { builder.setMessage(getActivity() .getString(mMessageId, (Object[]) mMessageParams)); } else { builder.setMessage(mMessageId); } } if (mIconId != 0) { builder.setIcon(mIconId); } if (mTitleId != 0) { builder.setTitle(mTitleId); } if (mPositiveLabelId != 0) { builder.setPositiveButton(mPositiveLabelId, mClickListener); } if (mNegativeLabelId != 0) { builder.setNegativeButton(mNegativeLabelId, mClickListener); } if (mNeutralLabelId != 0) { builder.setNeutralButton(mNeutralLabelId, mClickListener); } builder.setCancelable(isCancellable); setCancelable(isCancellable); return builder.create(); }