Ich habe das Problem, dass, wenn ich versuche, eine Adresse zu bekommen mit der geocoder.getFromLocationName ( „California“, 1) Funktion, er die Adresse gründet aber wenn ich es auf meinem Gerät testen (Xiaomi Mi5, Oreo) es gibt eine leere Liste.
Danke im Voraus!
private void geoLocate(){
Log.d(TAG, geoLocate: geolocating);
String searchString = mSearchText.getText().toString();
Log.d(TAG, geoLocate: Searching for + searchString);
Geocoder geocoder = new Geocoder(this);
List<Address> list = new ArrayList<>();
try{
if(geocoder.isPresent()){
list = geocoder.getFromLocationName(searchString,1);
} else{
Log.d(TAG, geoLocate: GEOCODER IS NOT PRESENT);
}
}catch (IOException e){
Log.e(TAG, geoLocate: IOException + e.getMessage() );
}
if(list.size() > 0 ){
Address address = list.get(0);
Log.d(TAG, geoLocate: found a location: + address.toString());
}else{
Log.d(TAG, geoLocate: Location not found);
}
}













