use of com.google.android.gms.location.places.ui.PlaceAutocompleteFragment in project IITB-App by wncc.
the class FileComplaintFragment method autoLocation.
private void autoLocation() {
final PlaceAutocompleteFragment autocompleteFragment = (PlaceAutocompleteFragment) getActivity().getFragmentManager().findFragmentById(R.id.place_autocomplete_fragment);
AutocompleteFilter typeFilter = new AutocompleteFilter.Builder().setCountry("IN").build();
autocompleteFragment.setFilter(typeFilter);
autocompleteFragment.setHint("Enter Location");
autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {
@Override
public void onPlaceSelected(com.google.android.gms.location.places.Place place) {
Location = place.getLatLng();
String Name = place.getName().toString();
Address = place.getAddress().toString();
// on selecting the place will automatically shows the Details on the map.
updateMap(Location, Name, Address, cursor);
cursor++;
}
@Override
public void onError(Status status) {
Log.i(TAG, "An error occurred: " + status);
}
});
}
use of com.google.android.gms.location.places.ui.PlaceAutocompleteFragment in project IITB-App by wncc.
the class FileComplaintFragment method onDestroyView.
@Override
public void onDestroyView() {
super.onDestroyView();
android.app.FragmentManager fragmentManager = getActivity().getFragmentManager();
PlaceAutocompleteFragment fragment = (PlaceAutocompleteFragment) fragmentManager.findFragmentById(R.id.place_autocomplete_fragment);
android.app.FragmentTransaction ft = fragmentManager.beginTransaction();
ft.remove(fragment);
ft.commit();
}
Aggregations