我正在使用GeoCoder获取我的应用程序中的位置。以下代码是:
Geocoder geoCoder = new Geocoder(this);
try {
List<Address> addresses = geoCoder.getFromLocationName("", 1);
if(null != addresses && addresses.size() > 0){
address = addresses.get(0);
List<Overlay> mapOverlay = mapView.getOverlays();
//This is new class to get address on basis on latitude and longitude
AddressOverlay addressOverlay = new AddressOverlay(address);
mapOverlay.add(addressOverlay);
final MapController mapController = mapView.getController();
//Start animating the map towards the given point.
mapController.animateTo(addressOverlay.getGeoPoint(), new Runnable(){
public void run(){
mapController.setZoom(12);
}
});
}else{
//No results for that address.
}
我遇到异常:第一行没有服务(刚刚尝试之后)。是否有任何人可以指导我并提供解决此问题的步骤?
等待及时回复!!