List of usage examples for android.app AlertDialog.Builder create
public void create()
From source file:com.ibuildapp.romanblack.CataloguePlugin.utils.Utils.java
/** * Show alert dialog with passed params//from w w w.j a v a 2 s .co m * * @param context context * @param title title of dialog * @param message message of dialog * @param positiveButtonText text of positive button (OK, for example) * @param negativeButtonText text of positive button (CANCEL, for example) * @param onDialogButtonClickListener listener of clicks dialog's buttons */ public static void showDialog(final Context context, final int title, final String message, final int positiveButtonText, final int negativeButtonText, final OnDialogButtonClickListener onDialogButtonClickListener) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setMessage(message); builder.setTitle(title); builder.setCancelable(false); builder.setPositiveButton(positiveButtonText, onDialogButtonClickListener != null ? new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { onDialogButtonClickListener.onPositiveClick(dialog); } } : null); builder.setNegativeButton(negativeButtonText, onDialogButtonClickListener != null ? new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { onDialogButtonClickListener.onNegativeClick(dialog); } } : null); builder.create().show(); }
From source file:org.geek.utils.ApplicationUtils.java
/** * Display a standard yes / no dialog.// w w w . j a va2 s . c o m * @param context The current context. * @param icon The dialog icon. * @param title The dialog title. * @param message The dialog message. * @param onYes The dialog listener for the yes button. */ public static void showYesNoDialog(Context context, int icon, int title, int message, DialogInterface.OnClickListener onYes) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setCancelable(true); builder.setIcon(icon); builder.setTitle(context.getResources().getString(title)); builder.setMessage(context.getResources().getString(message)); builder.setInverseBackgroundForced(true); builder.setPositiveButton(context.getResources().getString(R.string.Commons_Yes), onYes); builder.setNegativeButton(context.getResources().getString(R.string.Commons_No), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); AlertDialog alert = builder.create(); alert.show(); }
From source file:com.docd.purefm.ui.dialogs.PartitionInfoDialog.java
public Dialog onCreateDialog(final Bundle savedInstanceState) { final Activity activity = this.getActivity(); if (activity == null || activity.isFinishing()) { return null; }/*from w w w . j a v a 2 s . c o m*/ //noinspection InflateParams mView = activity.getLayoutInflater().inflate(R.layout.dialog_partition_info, null); final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setIcon(ThemeUtils.getDrawableNonNull(activity, R.attr.ic_menu_info)); builder.setTitle(R.string.menu_partition); builder.setView(mView); builder.setNeutralButton(R.string.close, null); return builder.create(); }
From source file:com.gmail.at.faint545.activities.DetailsActivity.java
private AlertDialog buildAlertDialog(String message) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(message);/*from w w w. ja v a 2s . c o m*/ builder.setCancelable(false); builder.setNegativeButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finish(); } }); return builder.create(); }
From source file:com.springsource.greenhouse.events.sessions.EventSessionRatingActivity.java
private void showSelectStarRatingDialog() { final CharSequence[] items = { "5 Stars", "4 Stars", "3 Stars", "2 Stars", "1 Star" }; AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Select a Star Value"); builder.setItems(items, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { setRating(5 - item);//from w ww. ja v a 2 s .c o m } }); AlertDialog alert = builder.create(); alert.show(); }
From source file:edu.usf.cutr.opentripplanner.android.tasks.ServerChecker.java
@Override protected void onPostExecute(String result) { if (activity.get() != null) { try {/*from w ww. j av a 2s. c o m*/ if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); } } catch (Exception e) { Log.e(TAG, "Error in Server Checker PostExecute dismissing dialog: " + e); } } if (showMessage) { if (activity.get() != null) { AlertDialog.Builder dialog = new AlertDialog.Builder(activity.get()); dialog.setTitle(context.getResources().getString(R.string.server_checker_info_dialog_title)); dialog.setMessage(result); dialog.setNeutralButton(context.getResources().getString(android.R.string.ok), null); dialog.create().show(); } } else { if (isWorking) { Toast.makeText(context, context.getResources().getString(R.string.server_checker_successful), Toast.LENGTH_SHORT).show(); } else { Toast.makeText(context, context.getResources().getString(R.string.custom_server_error), Toast.LENGTH_SHORT).show(); } } if (callback != null) { callback.onServerCheckerComplete(result, isWorking); } }
From source file:de.awisus.refugeeaidleipzig.views.profile.FragmentEditOffer.java
@NonNull @Override/*from www .ja v a2 s .c om*/ public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); View view = getActivity().getLayoutInflater().inflate(R.layout.fragment_edit_offer, null); builder.setView(view); Dialog dialog = builder.create(); initView(view); if (angebot == null) { forNewOffer(dialog); setListeners(view, true); } else { forExistingOffer(dialog); setListeners(view, false); } requestPermissions(); return dialog; }
From source file:com.springsource.greenhouse.twitter.PostTweetActivity.java
private void showResult(String result) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(result);//from ww w . jav a2 s . c o m builder.setCancelable(false); builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.show(); }
From source file:it.simoneloru.ctmdroid.activities.TimetableActivity.java
@Override protected Dialog onCreateDialog(int id) { AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this); alertBuilder.setMessage(R.string.unknowHost); alertBuilder.setTitle(android.R.string.dialog_alert_title); alertBuilder.setIcon(android.R.drawable.ic_dialog_alert); alertBuilder.setPositiveButton(android.R.string.ok, null); AlertDialog eulaMsg = alertBuilder.create(); return eulaMsg; }
From source file:com.example.clienttest.AbstractGreenhouseActivity.java
protected void displayAuthorizationError() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage("You are not authorized to connect to Greenhouse. Please reauthorize the app."); builder.setCancelable(false);/*from w ww .j a v a 2 s.c om*/ builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { signOut(); } }); AlertDialog alert = builder.create(); alert.show(); }