Created
June 1, 2019 22:58
-
-
Save Ikhiloya/9968befec6d7fd1dfd2be9de439d76e5 to your computer and use it in GitHub Desktop.
AutocompleteSupportFragment Initialization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Initialize the AutocompleteSupportFragment. | |
| AutocompleteSupportFragment autocompleteFragment = (AutocompleteSupportFragment) | |
| getSupportFragmentManager().findFragmentById(R.id.autocomplete_fragment); | |
| autocompleteFragment.setPlaceFields(Arrays.asList(Place.Field.ID, Place.Field.NAME)); | |
| autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() { | |
| @Override | |
| public void onPlaceSelected(Place place) { | |
| // TODO: Get info about the selected place. | |
| Log.i(TAG, "Place: " + place.getName() + ", " + place.getId()); | |
| } | |
| @Override | |
| public void onError(Status status) { | |
| // TODO: Handle the error. | |
| Log.i(TAG, "An error occurred: " + status); | |
| } | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how to initialize autocompletesupport fragment with data binding, please help