package com.lovoo;
import com.baidu.mapapi.BMapManager;
import com.baidu.mapapi.map.MapController;
import com.baidu.mapapi.map.MapView;
import com.baidu.platform.comapi.basestruct.GeoPoint;
import android.app.Activity;
import android.os.Bundle;
public class MapActivity extends Activity {
/** Called when the activity is first created. */
BMapManager mBMapMan = null;
MapView mMapView = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mBMapMan = new BMapManager(getApplication());
mBMapMan.init("73013ca62abc4715c08b1a79edff11bb", null);
System.out.println("111111111111");
setContentView(R.layout.activity_main);
mMapView =(MapView)findViewById(R.id.bmapsView);
mMapView.setBuiltInZoomControls(true);
System.out.println("222222222222");
//设置启用内置的缩放控件
MapController mMapController=mMapView.getController();
// 得到mMapView的控制权,可以用它控制和驱动平移和缩放
GeoPoint point =new GeoPoint((int)(39.915* 1E6),(int)(116.404* 1E6));
//用给定的经纬度构造一个GeoPoint,单位是微度 (度 * 1E6)
mMapController.setCenter(point);//设置地图中心点
mMapController.setZoom(12);//设置地图zoom级别
}
@Override
protected void onDestroy(){
mMapView.destroy();
if(mBMapMan!=null){
mBMapMan.destroy();
mBMapMan=null;
}
super.onDestroy();
}
@Override
protected void onPause(){
mMapView.onPause();
if(mBMapMan!=null){
mBMapMan.stop();
}
super.onPause();
}
protected void onResume(){
mMapView.onResume();
if(mBMapMan!=null){
mBMapMan.start();
}
super.onResume();
}
}
运行结果有错,其中有VM aborting 提示,代码是百度demo里面的,有大神指点下吗?