百度map定位及移动到中心点的有关问题

百度地图定位及移动到中心点的问题我的代码:public class Main extends MapActivity {// 地图引擎管理priv

百度地图定位及移动到中心点的问题
我的代码:


public class Main extends MapActivity {

// 地图引擎管理
private BMapManager mBMapManager;

// MapView控制
private MapController mMapController;

// MapView
private MapView mMapView;

// 地图覆盖物
private MyLocationOverlay mLocationOverlay;

// 当前经纬度
private GeoPoint myPoint;

// 定位监听
private LocationListener mLocationListener;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        mBMapManager = new BMapManager(getApplication());
        mBMapManager.init("65E876940AFB41F7DC232FFB11DBCECEC948591B", null);
        super.initMapActivity(mBMapManager);
        
        mMapView = (MapView)findViewById(R.id.bmapsView);
        
        // 设置启用内置的缩放控件
        mMapView.setBuiltInZoomControls(true);
        
        // 设定缩放时重新绘制覆盖物
        mMapView.setDrawOverlayWhenZooming(true);
        
        // 得到mMapView的控制权,可以用它控制和驱动平移和缩放
        mMapController = mMapView.getController();
        
        //设置地图zoom级别
        mMapController.setZoom(15);
        
        // 添加定位图层
        mLocationOverlay = new MyLocationOverlay(this, mMapView);
        // 添加定位覆盖物
        mMapView.getOverlays().add(mLocationOverlay);
        
        Drawable marker = getResources().getDrawable(R.drawable.shop);
        mMapView.getOverlays().add(new ShopOverLay(marker, Main.this));
 
        // 注册定位监听
        mLocationListener = new LocationListener() {

public void onLocationChanged(Location mLocation) {

if (mLocation != null) {
double latitude = mLocation.getLatitude();
        double longitude = mLocation.getLongitude();
        
        myPoint = new GeoPoint((int) (latitude * 1E6), (int) (longitude * 1E6));
        
        mMapController.animateTo(myPoint);
        // 设置地图中心点


        mMapController.setCenter(myPoint);
        
        // 设定比例尺
        mMapController.setZoom(16);
}
}
        };
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }

@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}

@Override
protected void onDestroy() {
if(mBMapManager != null) {
mBMapManager.destroy();
mBMapManager = null;
}

super.onDestroy();
}

@Override
protected void onPause() {
if(mBMapManager != null) {

mBMapManager.getLocationManager().removeUpdates(mLocationListener);
mLocationOverlay.disableMyLocation();
mLocationOverlay.disableCompass();

mBMapManager.stop();
}

super.onPause();

}

@Override
protected void onResume() {
if(mBMapManager != null) {

mBMapManager.getLocationManager().requestLocationUpdates(mLocationListener);
mLocationOverlay.enableMyLocation();
mLocationOverlay.enableCompass();

mBMapManager.start();
}

super.onResume();

}
}



用的是百度地图

现在的问题是:
1.地图一打开,中心点定位在天安门,移动下地图,会移动到定位位置,显示出定位覆盖物,问题是如何在地图一打开就自动将中心点移动到定位位置?

2.mMapController.animateTo(myPoint)和 mMapController.setCenter(myPoint)两个方法其他地方调用后似乎也没有效果,也是在移动地图后才产生效果。

哪位百度地图的高手能解释一下,谢谢。
[解决办法]
// 初始化Location模块 
MKLocationManager mLocationManager = MapLogic.mBMapMan.getLocationManager(); 
// 通过enableProvider和disableProvider方法,选择定位的Provider 
 mLocationManager.enableProvider(MKLocationManager.MK_GPS_PROVIDER);
[解决办法]
第一次打开百度地图确实是这样。
我的做法是记录最后一次定位的经纬度,下次再打开的时候直接使用MapController的setCenter显示地图。然后onLocationChanged更新和显示最新的定位结果。