use of com.google.android.gms.location.places.AutocompleteFilter 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.AutocompleteFilter in project UniPool by divya21raj.
the class NewEntryActivity method showPlaceAutocomplete.
private void showPlaceAutocomplete(int i) {
try {
AutocompleteFilter autocompleteFilter = new AutocompleteFilter.Builder().setTypeFilter(Place.TYPE_COUNTRY).setCountry("IN").build();
Intent intent = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_OVERLAY).setFilter(autocompleteFilter).build(this);
startActivityForResult(intent, i);
} catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) {
Toast.makeText(this, "Google Play Service Error!", Toast.LENGTH_SHORT).show();
}
}
Aggregations