Skip to content

Instantly share code, notes, and snippets.

@Ikhiloya
Created June 1, 2019 22:58
Show Gist options
  • Select an option

  • Save Ikhiloya/9968befec6d7fd1dfd2be9de439d76e5 to your computer and use it in GitHub Desktop.

Select an option

Save Ikhiloya/9968befec6d7fd1dfd2be9de439d76e5 to your computer and use it in GitHub Desktop.
AutocompleteSupportFragment Initialization
// 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);
}
});
}
@Hivanshu
Copy link
Copy Markdown

Hivanshu commented Sep 2, 2020

how to initialize autocompletesupport fragment with data binding, please help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment