2011-03-21 4 views
0

다음 코드가 있습니다 ...기본 Google지도 api - 오버레이 질문 추가 (GeoPoint에서 태그)

여기 가변 점은 Geopoint 객체입니다. 내 안드로이드의 현재 GPS 위치,이 시점에 업데이트 할 필요

...

어떻게 부릅니까? POINT에 현재 위치를 정의 하시겠습니까?!

// create a map view 
RelativeLayout linearLayout = (RelativeLayout) findViewById(R.id.mainlayout); 
    mapView = (MapView) findViewById(R.id.mapview); 
    mapView.setBuiltInZoomControls(true); 
    mapView.setStreetView(true); 
    mapController = mapView.getController(); 
    mapController.setZoom(14); // Zoom 1 is world view 
    locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); 
    locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,0, new GeoUpdateHandler()); 

    List<Overlay> mapOverlays = mapView.getOverlays(); 
    Drawable drawable = this.getResources().getDrawable(R.drawable.androidmarker); 
    HelloItemizedOverlay itemizedoverlay = new HelloItemizedOverlay(drawable); 

    OverlayItem overlayitem = new OverlayItem(point, "Hola, people!", "I am on Earth"); 
    itemizedoverlay.addOverlay(overlayitem); 
    mapOverlays.add(itemizedoverlay); 
} 

@Override 
protected boolean isRouteDisplayed() { 
    return false; 
} 

public class GeoUpdateHandler implements LocationListener { 

    @Override 
    public void onLocationChanged(Location location) { 
     int lat = (int) (location.getLatitude() * 1E6); 
     int lng = (int) (location.getLongitude() * 1E6); 
     GeoPoint point = new GeoPoint(lat, lng); 
     mapController.animateTo(point); 

     //mapController.setCenter(point); 



    } 

답변