0
이 코드를 사용하여 사용자의 현재 위치를 봅니다. 그러나 마커도 붙일 필요가 있습니다. 나는 이것에 관해서 약간의 튜토리얼을 보았다. 그러나 나는 아직도 그것을 얻지 않는다.지도보기 현재 위치의 마커
은 여기 내 활동
public class MapViewActivity extends MapActivity {
@Override
protected void onCreate(Bundle arg0) {
// TODO Auto-generated method stub
super.onCreate(arg0);
setContentView(R.layout.mapview);
//------------Start Displaying Map View--------------//
LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
LocationListener locationListener = new LocationListener() {
public void onLocationChanged(Location location) {
int lat = (int) (location.getLatitude() * 1E6);
int lng = (int) (location.getLongitude() * 1E6);
GeoPoint test= new GeoPoint(
lat,lng);
MapView mapview = (MapView) findViewById(R.id.mvmap);
MapController mapcontrol = mapview.getController();
mapcontrol.animateTo(test);
mapcontrol.setZoom(10);
mapview.setStreetView(true);
mapview.setSatellite(true);
mapview.setBuiltInZoomControls(true);
}
public void onProviderDisabled(String provider) {
// TODO Auto-generated method stub
}
public void onProviderEnabled(String provider) {
// TODO Auto-generated method stub
}
public void onStatusChanged(String provider, int status, Bundle extras) {
// TODO Auto-generated method stub
}
};
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);
이 [완료 tutoria]를 참조 (http://android-example-code.blogspot.in/p/map-api -in-android.html) – MAC