【发布时间】:2014-04-16 13:30:13
【问题描述】:
我正在使用标记进行反向地理编码。因此,取决于标记位置,它将获得经度和纬度,从而从地理编码器中获取地址。 问题是,在标记的某些位置,它的地址不正确,尽管位置可能正确,但剩余的“街道”等不正确,有时它根本不显示地址,TextView 仍保留其先前的输入。
下面是我的标记拖拽列表:
public void onMarkerDragEnd(Marker marker) {
LatLng position = marker.getPosition();
Geocoder geocoder = new Geocoder(MainActivity.this);
TextView textView1 = (TextView)findViewById(R.id.textView1);
try
{
List<Address> addresses = geocoder.getFromLocation(position.latitude,position.longitude,0);
for(Address address : addresses)
{
if(address.getLocality()!=null)
{
SubStreetNumber = address.getSubThoroughfare ();
Street = address.getThoroughfare();
Area = address.getSubLocality ();
City = address.getLocality();
PostCode = address.getPostalCode();
break;
}
textView1.setText(SubStreetNumber + ", " + Street + ", " + City + ", " + PostCode);
}
}
catch(IOException ioException)
{
Log.e("MyApp","Exception",ioException);
}
}
【问题讨论】:
标签: javascript android google-maps geocoding