List of usage examples for android.app AlertDialog.Builder setIcon
public void setIcon(Drawable icon)
From source file:com.docd.purefm.ui.dialogs.FilePropertiesDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { final Activity activity = getActivity(); if (activity == null || activity.isFinishing()) { return null; }/*www .j a v a 2 s . c o m*/ final AlertDialog.Builder builder = new AlertDialog.Builder(activity); mAdapter = new PropertiesAdapter(activity, file); builder.setIcon(ThemeUtils.getDrawableNonNull(activity, R.attr.ic_menu_info)); builder.setTitle(file.getName()); builder.setNeutralButton(R.string.close, null); builder.setPositiveButton(R.string.apply, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { final FilePermissionsPagerItem fragment = (FilePermissionsPagerItem) mAdapter.getItem(1); fragment.applyPermissions(getActivity()); } }); //noinspection InflateParams final View content = activity.getLayoutInflater().inflate(R.layout.dialog_properties_container, null); if (content == null) { throw new RuntimeException("Inflated view is null"); } this.initView(content); builder.setView(content); final AlertDialog dialog = builder.create(); dialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(final DialogInterface dialog) { final Button button = ((AlertDialog) dialog).getButton(DialogInterface.BUTTON_POSITIVE); if (button == null) { throw new RuntimeException("Can't get positive button"); } button.setVisibility(View.GONE); } }); return dialog; }
From source file:com.nextgis.ngm_clink_monitoring.fragments.ObjectStatusFragment.java
public boolean onContextItemSelected(MenuItem menuItem) { final long itemId; try {/*w ww .j av a2s . c o m*/ itemId = ((ObjectPhotoCursorAdapter) mPhotoGallery.getAdapter()).getSelectedItemId(); } catch (Exception e) { Log.d(TAG, e.getLocalizedMessage()); return super.onContextItemSelected(menuItem); } switch (menuItem.getItemId()) { case R.id.menu_show_photo: showPhoto(itemId); break; case R.id.menu_delete_photo: AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext); alertDialog.setIcon(R.drawable.ic_action_warning) .setTitle(mContext.getResources().getString(R.string.delete_photo_ask)) .setMessage(mContext.getResources().getString(R.string.delete_photo_message)) .setNegativeButton(mContext.getResources().getString(R.string.cancel), null) .setPositiveButton(mContext.getResources().getString(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { deletePhoto(itemId); } }) .show(); break; } return super.onContextItemSelected(menuItem); }
From source file:com.android.gallery3d.app.AbstractGalleryActivity.java
@Override protected void onStart() { super.onStart(); if (getExternalCacheDir() == null) { OnCancelListener onCancel = new OnCancelListener() { @Override//w w w.j a v a 2 s. c om public void onCancel(DialogInterface dialog) { finish(); } }; OnClickListener onClick = new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }; AlertDialog.Builder builder = new AlertDialog.Builder(this).setTitle(R.string.no_external_storage_title) .setMessage(R.string.no_external_storage).setNegativeButton(android.R.string.cancel, onClick) .setOnCancelListener(onCancel); if (ApiHelper.HAS_SET_ICON_ATTRIBUTE) { setAlertDialogIconAttribute(builder); } else { builder.setIcon(android.R.drawable.ic_dialog_alert); } mAlertDialog = builder.show(); registerReceiver(mMountReceiver, mMountFilter); } mPanoramaViewHelper.onStart(); }
From source file:net.evecom.android.log.DailyLogLookActivity.java
/** * //from w ww . j av a2 s .c o m * * @param errorMsg */ private void DialogToast(String errorMsg) { AlertDialog.Builder builder1 = new AlertDialog.Builder(DailyLogLookActivity.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:tw.idv.palatis.danboorugallery.PostListActivity.java
@Override public boolean onItemLongClick(final AdapterView<?> parent, View view, int position, long id) { Object item = parent.getAdapter().getItem(position); if (item instanceof Cursor) { final Cursor cursor = (Cursor) item; final int host_id = cursor.getInt(HostsTable.INDEX_HOST_DATABASE_ID); PopupMenu popup = new PopupMenu(PostListActivity.this, view); popup.inflate(R.menu.popupmenu_host_item); popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override/*from w w w.ja v a 2 s . co m*/ public boolean onMenuItemClick(MenuItem menuItem) { final Host host = SiteSession.getHostById(host_id); int id = menuItem.getItemId(); switch (id) { case R.id.popupmenu_host_item_edit: Intent intent = new Intent(PostListActivity.this, NewHostActivity.class); intent.putExtra(Host.TABLE_NAME + Host.KEY_HOST_DATABASE_ID, host.id); startActivity(intent); return true; case R.id.popupmenu_host_item_delete: AlertDialog.Builder b = new AlertDialog.Builder(PostListActivity.this); b.setTitle(R.string.dialog_delete_host_title); b.setMessage(getResources().getString(R.string.dialog_delete_host_message, host.name, host.url, host.getLogin(), host.getAPI().getName())); b.setIcon(android.R.drawable.ic_dialog_alert); b.setNegativeButton(android.R.string.cancel, null); b.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { HostsTable.removeHost(host); } }); b.create().show(); return true; } return false; } }); popup.setForceShowIcon(true); popup.show(); return true; } return false; }
From source file:com.spydiko.rotationmanager.MainActivity.java
public void showPlayStoreDialog(View view) { AlertDialog.Builder builder = new AlertDialog.Builder(this); // Add the buttons builder.setTitle("Spydiko"); builder.setMessage(R.string.landing_msg); builder.setIcon(R.drawable.icon); builder.setPositiveButton(R.string.playStore, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User clicked OK button Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("market://search?q=pub:Spydiko")); startActivity(intent);/*from www .jav a 2 s . com*/ } }); builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User cancelled the dialog } }); // Set other dialog properties // Create the AlertDialog AlertDialog dialog = builder.create(); // AppSpecificOrientation.ALREADY_SHOWED = true; // AppSpecificOrientation.RETURN_FROM_ABOUT = false; dialog.show(); }
From source file:it.sasabz.android.sasabus.fragments.OnlineSearchFragment.java
public final Dialog createErrorDialog(int msg) { AlertDialog.Builder builder = new AlertDialog.Builder(this.getActivity()); // builder.setTitle(R.string.a_given_string); builder.setIcon(R.drawable.icon); builder.setMessage(msg);/* ww w.ja va2s . c om*/ builder.setNeutralButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); System.exit(-3); } }); return builder.create(); }
From source file:org.godotengine.godot.FireBase.java
public void alertMsg(String title, String message) { AlertDialog.Builder bld; bld = new AlertDialog.Builder(activity, AlertDialog.THEME_HOLO_LIGHT); bld.setIcon(com.godot.game.R.drawable.icon); bld.setTitle(title);/*from ww w .j a v a2 s. c o m*/ bld.setMessage(message); bld.setNeutralButton("OK", null); bld.create().show(); }
From source file:it.sasabz.android.sasabus.fragments.OnlineSearchFragment.java
public final Dialog createDownloadAlertDialog(int msg) { AlertDialog.Builder builder = new AlertDialog.Builder(this.getActivity()); // builder.setTitle(R.string.a_given_string); builder.setIcon(R.drawable.icon); //builder.setMessage(msg); builder.setMessage(msg);/* w ww . j a va2 s . c om*/ builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); Intent download = new Intent(getThis().getActivity(), CheckDatabaseActivity.class); myStartActivity(download); } }); builder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); return builder.create(); }
From source file:net.evecom.android.log.DailyLogLookActivity.java
/** * //from www. ja v a 2 s . c o m * * @param v */ public void daily_log_more_delete(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) { progressDialog = ProgressDialog.show(DailyLogLookActivity.this, "", "..."); formSubmit1(); } }); builder.setNegativeButton("", new DialogInterface.OnClickListener() { // @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.show(); }