I am using setBoundsBias for Restrict autocomplete results in google map autocompletePlace, But the result contains places out of range.
what is the problem ?
{
final int PLACE_AUTOCOMPLETE_REQUEST_CODE = 1;
AutocompleteFilter typeFilter = new AutocompleteFilter.Builder()
.setCountry("IR")
.build();
try {
Intent intent =
new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_OVERLAY)
.setBoundsBias(new LatLngBounds(new LatLng(38.051183, 46.211586),
new LatLng(38.132784, 46.392860)))
.setFilter(typeFilter)
.build(MainActivity.this);
startActivityForResult(intent, PLACE_AUTOCOMPLETE_REQUEST_CODE);
overridePendingTransition(R.anim.fadein, R.anim.fadeout);
} catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) {
e.fillInStackTrace();
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…