List of usage examples for android.app AlertDialog.Builder show
public void show()
From source file:br.com.GUI.avaliacoes.NovaAvaliacao.java
@Override public void onBackPressed() { AlertDialog.Builder alertDialog = new AlertDialog.Builder(this); alertDialog.setTitle("Ateno"); alertDialog.setMessage(//from w w w . ja va 2 s. co m "Voc tem certeza que deseja sair desta avaliao?\n Todos os dados que no foram salvos sero perdidos!"); alertDialog.setIcon(R.drawable.critical); alertDialog.setPositiveButton("Sim", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { editor.clear(); editor.commit(); finish(); } }); alertDialog.setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); alertDialog.show(); }
From source file:br.com.split.activities.FacebookFriendPickerActivity.java
private void onSessionStateChanged(final Session session, SessionState state, Exception exception) { if (state.isOpened() && !sessionHasNecessaryPerms(session)) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(R.string.need_perms_alert_text); builder.setPositiveButton(R.string.need_perms_alert_button_ok, new DialogInterface.OnClickListener() { @Override/* ww w.j a v a2 s . c om*/ public void onClick(DialogInterface dialog, int which) { session.requestNewReadPermissions(new NewPermissionsRequest(FacebookFriendPickerActivity.this, getMissingPermissions(session))); } }); builder.setNegativeButton(R.string.need_perms_alert_button_quit, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finish(); } }); builder.show(); startPickFriendsActivity(); } else if (pickFriendsWhenSessionOpened && state.isOpened()) { pickFriendsWhenSessionOpened = false; startPickFriendsActivity(); } }
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 w w . j a va2s .c om*/ } 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.blueverdi.rosietheriveter.PhotoViewActivity.java
private void hintScreen() { mPrefs = PreferenceManager.getDefaultSharedPreferences(this); showHint = mPrefs.getBoolean(GalleryFragment.showHintPref, true); if (showHint) { LayoutInflater li = LayoutInflater.from(this); View view = li.inflate(R.layout.photo_hint_screen, null); AlertDialog.Builder builder = new AlertDialog.Builder(this); CheckBox cb = (CheckBox) view.findViewById(R.id.chkWelcome); cb.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (((CheckBox) buttonView).isChecked()) { showHint = false;/*from w w w .ja v a 2 s. c o m*/ } else { showHint = true; } } }); Button b = (Button) view.findViewById(R.id.exitPhotoHintButton); b.setOnClickListener(this); builder.setTitle(null); builder.setView(view); hintDialog = builder.show(); } }
From source file:com.bwash.bwashcar.activities.CompanyActivity.java
/** * This method shows dialog with given title & message. * Also there is an option to pass onClickListener for positive & negative button. * * @param title - dialog title * @param message - dialog message * @param onPositiveButtonClickListener - listener for positive button * @param positiveText - positive button text * @param onNegativeButtonClickListener - listener for negative button * @param negativeText - negative button text *//* ww w . j a v a 2s . c o m*/ protected void showAlertDialog(@Nullable String title, @Nullable String message, @Nullable DialogInterface.OnClickListener onPositiveButtonClickListener, @NonNull String positiveText, @Nullable DialogInterface.OnClickListener onNegativeButtonClickListener, @NonNull String negativeText) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(title); builder.setMessage(message); builder.setPositiveButton(positiveText, onPositiveButtonClickListener); builder.setNegativeButton(negativeText, onNegativeButtonClickListener); mAlertDialog = builder.show(); }
From source file:com.googlecode.CallerLookup.Main.java
public void doSubmit() { String entry = ""; if (mLookup.getSelectedItemPosition() != 0) { entry = mLookup.getSelectedItem().toString() + "\n"; }/*www .j av a 2s . c o m*/ entry += mURL.getText().toString() + "\n"; entry += mRegExp.getText().toString() + "\n"; try { String[] mailto = { EMAIL_ADDRESS }; Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_EMAIL, mailto); sendIntent.putExtra(Intent.EXTRA_SUBJECT, EMAIL_SUBJECT); sendIntent.putExtra(Intent.EXTRA_TEXT, entry); sendIntent.setType("message/rfc822"); startActivity(sendIntent); } catch (ActivityNotFoundException e) { e.printStackTrace(); AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(R.string.SubmitFailureTitle); alert.setMessage(R.string.SubmitFailureMessage); alert.setPositiveButton(android.R.string.ok, null); alert.show(); } }
From source file:fi.mikuz.boarder.gui.internet.InternetMenu.java
@Override public void onConnectionSuccessful(ConnectionSuccessfulResponse connectionSuccessfulResponse) throws JSONException { ConnectionUtils.connectionSuccessful(InternetMenu.this, connectionSuccessfulResponse); if (ConnectionUtils.checkConnectionId(connectionSuccessfulResponse, InternetMenu.mGetServiceVersionURL)) { mDatabaseVersionChecked = true;//from www.j ava 2 s .c o m int serviceVersion = connectionSuccessfulResponse.getJSONObject().getInt(ConnectionUtils.returnData); if (serviceVersion == -1) { AlertDialog.Builder builder = new AlertDialog.Builder(InternetMenu.this); builder.setTitle("Maintenance"); builder.setMessage("Boarder web service is under maintenance. Please try again later."); builder.setCancelable(false); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { InternetMenu.this.finish(); } }); builder.show(); } else if (mServiceVersion < serviceVersion) { AlertDialog.Builder builder = new AlertDialog.Builder(InternetMenu.this); builder.setTitle("Old version"); builder.setMessage( "You have an old version of Boarder. Your version is not compatible with Boarder web service.\n\n" + "Please update."); builder.setCancelable(false); builder.setPositiveButton("Update", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { ExternalIntent.openGooglePlay(InternetMenu.this); InternetMenu.this.finish(); } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { InternetMenu.this.finish(); } }); builder.show(); } } else if (ConnectionUtils.checkConnectionId(connectionSuccessfulResponse, InternetMenu.mGetSessionValidURL)) { mSessionValidityChecked = true; if (connectionSuccessfulResponse.getJSONObject().getInt(InternetMenu.SESSION_VALID_KEY) == 0) { startLogin(); } else { String accountMessage = connectionSuccessfulResponse.getJSONObject() .getString(InternetMenu.ACCOUNT_MESSAGE_KEY); updateAccountMessage(accountMessage); } } afterConnection(); }
From source file:fr.pasteque.client.Configure.java
/** * Display an AlertDialog/* w ww .j ava 2s. com*/ * Based on Error.showError() but Configuration is not a TrackedActivity * * @param message to display */ private void showError(String message) { AlertDialog.Builder b = new AlertDialog.Builder(this); b.setTitle(R.string.error_title); b.setMessage(message); b.setIcon(android.R.drawable.ic_dialog_alert); b.setCancelable(true); b.setNegativeButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { Configure.this.invalidateError(); } }); b.show(); }
From source file:com.openerp.addons.note.EditNoteFragment.java
public void openDailogview(String title, String message, String positivebtnText, String negativebtnText) { AlertDialog.Builder deleteDialogConfirm = new AlertDialog.Builder(scope.context()); deleteDialogConfirm.setTitle(title); deleteDialogConfirm.setMessage(message); deleteDialogConfirm.setCancelable(true); deleteDialogConfirm.setPositiveButton(positivebtnText, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { flag = true;// www . j a va2 s.co m getActivity().getSupportFragmentManager().popBackStack(); } }); deleteDialogConfirm.setNegativeButton(negativebtnText, null); deleteDialogConfirm.show(); }
From source file:com.citrus.sdk.fragments.SavedOptions.java
private void showPopup() { final String email = OneClicksignup.getDefaultGmail(getActivity()); final BooleanTask ontask = new BooleanTask() { @Override//from w ww . j a v a 2 s .co m public void ontaskComplete(boolean result) { if (result) { Toast.makeText(getActivity().getApplicationContext(), "An Email has been sent to you", Toast.LENGTH_SHORT).show(); } } }; final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle("Reset Password?"); builder.setMessage("An email will be sent to " + email); builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { new ResetPassword(getActivity(), email, ontask).execute(); } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { } }); builder.create(); builder.show(); }