运行不起来,总是强制关闭。主要代码如下:
locationManager=(LocationManager)getSystemService(Context.LOCATION_SERVICE);
locationButton=(Button)findViewById(R.id.locationButtonId);
locationButton.setOnClickListener(new LocationButtonListener());
//GeoPoint对象,通过经纬度指定地图上的点
GeoPoint point=new GeoPoint((int)(latitude*1E6),(int)(longitude*1E6));
MapView mapView=(MapView)findViewById(R.id.map_view);
MapController mapControl=mapView.getController();
mapView.displayZoomControls(true);
mapControl.animateTo(point);
mapControl.setZoom(7);
//调用mapView对象的get方法,得到所有图层对象
List<Overlay> mapOverlays=mapView.getOverlays();
Drawable drawable=getResources().getDrawable(R.drawable.icon);
FirstOverlay firstOverlay=new FirstOverlay(drawable,this);
OverlayItem overlayItem=new OverlayItem(point,"Hello","I,m in xxx");
firstOverlay.addOverlay(overlayItem);
mapOverlays.add(firstOverlay);
locationManager=(LocationManager)getSystemService(Context.LOCATION_SERVICE);
locationButton=(Button)findViewById(R.id.locationButtonId);
locationButton.setOnClickListener(new LocationButtonListener());
//GeoPoint对象,通过经纬度指定地图上的点
GeoPoint point=new GeoPoint((int)(latitude*1E6),(int)(longitude*1E6));
MapView mapView=(MapView)findViewById(R.id.map_view);
MapController mapControl=mapView.getController();
mapView.displayZoomControls(true);
mapControl.animateTo(point);
mapControl.setZoom(7);
//调用mapView对象的get方法,得到所有图层对象
List<Overlay> mapOverlays=mapView.getOverlays();
Drawable drawable=getResources().getDrawable(R.drawable.icon);
FirstOverlay firstOverlay=new FirstOverlay(drawable,this);
OverlayItem overlayItem=new OverlayItem(point,"Hello","I,m in xxx");
firstOverlay.addOverlay(overlayItem);
mapOverlays.add(firstOverlay);
解决方案 »
- Activity中嵌入两个Activity出错
- setOnCheckedChangeListener 问题
- 网上这段 获取Android ip地址的代码 没注释 看不懂 谁能给我解释下?谢谢
- 想用android手机看海康监控的实时或录像视频,请问有对应的play SDK吗?或有其他实现方式吗?
- 运行期日志文件,有实现的可能吗?
- android 新浪微博开发疑问
- android 2.2 无法正确监听数据库问题
- 关于android中AsyncTask和jni技术简单应用--附源码
- Activity的跳转问题 intent的携带数据
- jni调用system函数没有反应
- 获取公网的IP
- 求教:学习C++需要什么知识(C语言已学过)
你的开发手机有google map的包么?
你申请了google map的key了么?
Manifest.xml里面声明了权限了么?
有google map包,申请了key,也声明了权限,并没有发现报错,就是运行不起来好郁闷。