正如我所说的那样,它是自动完成的,并且iv使用了标记拖动的侦听器,并且它在模拟器中工作正常,并且可以获取适当的地址及其详细信息。它说的是,当我在我的物理设备上运行,但在仿真器中可以给出正确结果我已经执行了所有请求,权限
mMap.setOnMarkerDragListener(new GoogleMap.OnMarkerDragListener() {
@Override
public void onMarkerDragStart(Marker marker) {
}
@Override
public void onMarkerDrag(Marker marker) {
}
@Override
public void onMarkerDragEnd(Marker marker) {
List<android.location.Address> addresses=null;
geocoder=new Geocoder(MapActivity.this);
LatLng ll=marker.getPosition();
try {
addresses =geocoder.getFromLocation(ll.latitude,ll.longitude, 1);
if (addresses.size()>0&&addresses!=null){
Address returnedAddress = addresses.get(0);
StringBuilder strReturnedAddress = new StringBuilder("Address:\n");
for(int i=0; i<returnedAddress.getMaxAddressLineIndex(); i++) {
strReturnedAddress.append(returnedAddress.getAddressLine(i)).append("\n");
}Log.d("RESULT",strReturnedAddress.toString());
marker.setSnippet(returnedAddress.getLocale().toString());
pickupAutocomplete.setText(returnedAddress.getLocality().toUpperCase());
}
else {
Log.d("NO-RESULT","NO-RESULT");
}
} catch (IOException e) {
e.printStackTrace();
Log.d("NO-RESULT","NO-RESULT");
}
}
});