private void onClickPickPlace() { final PlacePickerFragment fragment = new PlacePickerFragment(); fragment.setLocation(SEATTLE_LOCATION); fragment.setTitleText("place"); setPlacePickerListeners(fragment); showPickerFragment(fragment); }
private void setPlacePickerListeners(final PlacePickerFragment fragment) { fragment.setOnDoneButtonClickedListener( new PlacePickerFragment.OnDoneButtonClickedListener() { public void onDoneButtonClicked(PickerFragment<?> pickerFragment) { onPlacePickerDone(fragment); } }); fragment.setOnSelectionChangedListener( new PlacePickerFragment.OnSelectionChangedListener() { public void onSelectionChanged(PickerFragment<?> pickerFragment) { if (fragment.getSelection() != null) { onPlacePickerDone(fragment); } } }); }
private void onPlacePickerDone(PlacePickerFragment fragment) { FragmentManager fm = getSupportFragmentManager(); fm.popBackStack(); String result = ""; GraphPlace selection = fragment.getSelection(); if (selection != null) { result = selection.getName(); } else { result = "no place"; } showAlert("picked", result); }