List of usage examples for android.app AlertDialog.Builder show
public void show()
From source file:br.com.GUI.perfil.PerfilAluno.java
public void tirarFoto() { AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity()); alertDialog.setTitle("Selecione o mtodo"); alertDialog.setMessage("Deseja usar qual aplicativo para importar sua foto?"); alertDialog.setIcon(R.drawable.profile); alertDialog.setPositiveButton("Camera", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { usarCamera();/*from w ww . j a v a2 s .co m*/ } }); alertDialog.setNegativeButton("Galeria", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { usarGaleria(); dialog.cancel(); } }); alertDialog.show(); }
From source file:com.dtr.zxing.activity.CaptureActivity.java
private void displayFrameworkBugMessageAndExit() { // camera error AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getString(R.string.app_name)); builder.setMessage("???"); builder.setPositiveButton("", new DialogInterface.OnClickListener() { @Override//from w w w. jav a 2s .c o m public void onClick(DialogInterface dialog, int which) { finish(); } }); builder.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { finish(); } }); builder.show(); }
From source file:br.liveo.ndrawer.ui.fragment.MainFragment32.java
private void successDialog() { AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity()); alertDialog.setTitle(" ? "); alertDialog.setMessage("? ? ??"); alertDialog.setIcon(R.drawable.ic_dialog_alert); alertDialog.setPositiveButton("", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel();/*w w w. j av a2 s . c o m*/ Fragment mFragment; FragmentManager mFragmentManager = getActivity().getSupportFragmentManager(); mFragment = new ViewPagerFragment3(); if (mFragment != null) { mFragmentManager.beginTransaction().replace(R.id.container, mFragment).commit(); } } }); alertDialog.show(); }
From source file:com.jdom.get.stuff.done.android.AndroidApplicationContextFactory.java
public void displayCollectionOfItemsAsCheckBoxes(final Collection<String> collection, final Collection<String> initialSelections, final RunnableWithResults<Collection<String>> callback) { final String[] array = collection.toArray(new String[collection.size()]); boolean[] checked = new boolean[collection.size()]; for (int i = 0; i < array.length; i++) { String value = array[i];//from ww w . ja v a 2 s .co m checked[i] = initialSelections.contains(value); } final List<String> selectedItems = new ArrayList<String>(); for (String initialSelection : initialSelections) { selectedItems.add(initialSelection); } AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setCancelable(false).setPositiveButton(OK_BUTTON_TEXT, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { callback.callback(selectedItems); } }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }).setMultiChoiceItems(array, checked, new DialogInterface.OnMultiChoiceClickListener() { public void onClick(DialogInterface dialog, int which, boolean isChecked) { String value = array[which]; if (isChecked && !selectedItems.contains(value)) { selectedItems.add(value); } else { selectedItems.remove(value); } } }); builder.show(); }
From source file:com.code.android.vibevault.ShowDetailsScreen.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.nowPlaying: //Open playlist activity Intent i = new Intent(ShowDetailsScreen.this, NowPlayingScreen.class); startActivity(i);/* w ww . ja v a2s . co m*/ break; case R.id.recentShows: Intent rs = new Intent(ShowDetailsScreen.this, RecentShowsScreen.class); startActivity(rs); break; case R.id.scrollableDialog: AlertDialog.Builder ad = new AlertDialog.Builder(this); ad.setTitle("Help!"); View v = LayoutInflater.from(this).inflate(R.layout.scrollable_dialog, null); ((TextView) v.findViewById(R.id.DialogText)).setText(R.string.show_details_screen_help); ad.setPositiveButton("Okay.", new android.content.DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int arg1) { } }); ad.setView(v); ad.show(); break; case R.id.emailLink: final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("plain/text"); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Great show on archive.org: " + show.getArtistAndTitle()); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Hey,\n\nYou should listen to " + show.getArtistAndTitle() + ". You can find it here: " + show.getShowURL() + "\n\nSent using VibeVault for Android."); startActivity(Intent.createChooser(emailIntent, "Send mail...")); break; case R.id.downloadShow: for (int j = 0; j < downloadLinks.size(); j++) { downloadLinks.get(j).setDownloadShow(show); dService.addSong(downloadLinks.get(j)); } break; default: break; } return true; }
From source file:fi.mikuz.boarder.gui.internet.Login.java
private void showLoggedOutView() { setContentView(R.layout.internet_login_logged_out); mLogin = (Button) findViewById(R.id.submit); mUsername = (EditText) findViewById(R.id.userName); mPassword = (EditText) findViewById(R.id.userPassword); boolean usernameInDb = false; String dbPassword = null;//from ww w .j ava 2s .com try { Cursor loginCursor = mDbHelper.fetchLogin(InternetMenu.USERNAME_KEY); startManagingCursor(loginCursor); mUsername.setText(loginCursor.getString(loginCursor.getColumnIndexOrThrow(LoginDbAdapter.KEY_DATA))); usernameInDb = true; } catch (SQLException e) { Log.d(TAG, "Couldn't get database login info", e); } catch (CursorIndexOutOfBoundsException e) { Log.d(TAG, "Couldn't get database login info", e); } dbPassword = getDbPassword(); final CheckBox rememberPassword = (CheckBox) findViewById(R.id.rememberPassword); if (dbPassword == null) { rememberPassword.setChecked(false); } else { rememberPassword.setChecked(true); mPassword.setText(dbPassword); } final CheckBox rememberUsername = (CheckBox) findViewById(R.id.rememberUsername); rememberUsername.setChecked(usernameInDb); mLogin.setOnClickListener(new OnClickListener() { public void onClick(View v) { mWaitDialog = new TimeoutProgressDialog(Login.this, "Waiting for response", TAG, false); String username = mUsername.getText().toString(); String password = mPassword.getText().toString(); Boolean entrancePassword = true; String dbPassword = getDbPassword(); // Password in the Android database is always the same as in the server database // Being an entrance password means that the password is not the same as in the server database if (dbPassword != null) { if (dbPassword.equals(password)) { entrancePassword = false; } } // If the password is now an entrance password then it's plain text and wants to be hashed if (entrancePassword) { try { password = Security.passwordHash(password); } catch (NoSuchAlgorithmException e) { String msg = "Couldn't make a password hash"; Toast.makeText(Login.this, msg, Toast.LENGTH_LONG).show(); Log.e(TAG, msg, e); } } if (rememberUsername.isChecked()) { mDbHelper.putLogin(InternetMenu.USERNAME_KEY, username); } else if (!rememberUsername.isChecked()) { mDbHelper.deleteLogin(InternetMenu.USERNAME_KEY); } if (rememberPassword.isChecked()) { if (!entrancePassword) { mPasswordOperation = PASSWORD_OPERATION_NONE; mDbHelper.putLogin(InternetMenu.PASSWORD_KEY, password); } else { mPasswordOperation = PASSWORD_OPERATION_SAVE; } } else if (!rememberPassword.isChecked()) { mDbHelper.deleteLogin(InternetMenu.PASSWORD_KEY); } mDbHelper.deleteLogin(InternetMenu.USER_ID_KEY); mDbHelper.deleteLogin(InternetMenu.SESSION_TOKEN_KEY); CheckBox rememberSession = (CheckBox) findViewById(R.id.rememberSession); if (rememberSession.isChecked()) { mRememberSession = true; } HashMap<String, String> sendList = new HashMap<String, String>(); sendList.put(InternetMenu.USERNAME_KEY, username); sendList.put(InternetMenu.PASSWORD_KEY, password); sendList.put(InternetMenu.ENTRANCE_PASSWORD_KEY, entrancePassword ? "1" : "0"); new ConnectionManager(Login.this, InternetMenu.mLoginURL, sendList); } }); Button recoverPassword = (Button) findViewById(R.id.recoverPassword); recoverPassword.setOnClickListener(new OnClickListener() { public void onClick(View v) { LayoutInflater inflater = (LayoutInflater) Login.this.getSystemService(LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.internet_login_alert_recover_password, (ViewGroup) findViewById(R.id.alert_settings_root)); final EditText input = (EditText) layout.findViewById(R.id.input); Button submitButton = (Button) layout.findViewById(R.id.submitButton); AlertDialog.Builder builder = new AlertDialog.Builder(Login.this); builder.setView(layout); builder.setTitle("Password recovery"); submitButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { mWaitDialog = new TimeoutProgressDialog(Login.this, "Waiting for response", TAG, false); String inputText = input.getText().toString(); HashMap<String, String> sendList = new HashMap<String, String>(); sendList.put(InternetMenu.EMAIL_KEY, inputText); new ConnectionManager(Login.this, InternetMenu.mRecoverPasswordURL, sendList); } }); builder.show(); } }); }
From source file:com.paramedic.mobshaman.fragments.AccionesDetalleServicioFragment.java
private void showUploadPhotoPopup(final boolean isFinishingService) { AlertDialog.Builder adb = new AlertDialog.Builder(getActivity()); adb.setTitle("Adjuntar imagen"); adb.setMessage("Desea adjuntar una imagen al incidente?"); adb.setPositiveButton("Si", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dispatchTakePictureIntent(isFinishingService); }// www . j a va 2 s . com }); adb.setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { if (isFinishingService) { finishIncident(); } dialog.cancel(); } }); adb.show(); }
From source file:me.henrytao.smoothappbarlayoutdemo.activity.BaseActivity.java
private void showDonateDialogSuccessCallback(final List<PurchaseItem> data) { PurchaseAdapter adapter = new PurchaseAdapter(this, data); AlertDialog.Builder builder = new AlertDialog.Builder(this).setTitle(R.string.text_donate) .setCancelable(false).setAdapter(adapter, new DialogInterface.OnClickListener() { @Override/*from w ww . jav a2 s. co m*/ public void onClick(DialogInterface dialog, int which) { onDonate(data.get(which)); } }).setPositiveButton(R.string.close, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { new AlertDialog.Builder(BaseActivity.this).setMessage(getString(R.string.text_help_offer)) .setPositiveButton(R.string.close, null).show(); } }); builder.show(); }
From source file:net.evecom.androidecssp.base.BaseActivity.java
/** * //from w w w . j a va 2s . 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:com.example.drugsformarinemammals.ViewPager_Pinnipeds.java
private void displayMessage(String messageTitle, String message) { AlertDialog.Builder myalert = new AlertDialog.Builder(this); TextView title = new TextView(this); title.setTypeface(Typeface.SANS_SERIF); title.setTextSize(20);//w w w . ja va 2 s .com title.setTextColor(getResources().getColor(R.color.blue)); title.setPadding(8, 8, 8, 8); title.setText(""); title.setGravity(Gravity.CENTER_VERTICAL); LinearLayout layout = new LinearLayout(this); TextView text = new TextView(this); text.setTypeface(Typeface.SANS_SERIF); text.setTextSize(20); text.setPadding(10, 10, 10, 10); text.setText(message); layout.addView(text); myalert.setView(layout); myalert.setCustomTitle(title); myalert.setCancelable(true); myalert.show(); }