2011-03-16 5 views
2

내가 쉽게 myLocationOverlay 내 위치를 취할 수 있으며, 내 위치의 중심으로 설정하려면, 내가지도 컨트롤러 시도 :mylocationoverlay로 내 위치의 중앙에 배치하려면 어떻게해야합니까?

MapController mc = myMap.getController(); 
mc.animateTo(); 
mc.setCenter(myLocOverlay.getMyLocation()); 

이 코드 didnt 한 작업은 그래서 변화를

p = new GeoPoint((int) (myLocOverlay.getMyLocation().getLatitudeE6()), (int) (myLocOverlay.getMyLocation().getLongitudeE6())); 

mc.setCenter(p); 

그러나 좋은 소식이 없습니다. .. 사전에 대한 .. 감사합니다 그럼 내가 널 포인터 예외를했다 나는 myLocationOverlay()하지만이 작동하지 전에 새 위치를 지정

답변

2

animateTo이 사용할 수 있습니다

GeoPoint point = this.currentLocationOverlay.getMyLocation(); 
if(point==null) 
    return; 
//center map on that geopoint 
mc.animateTo(point); 
관련 문제