当前位置:编程学习 > wap >>

android MapView不显示地图

@Override
public void onLocationChanged(Location location) {
Log.d(TAG,"MyLocationListener onLocationChanged");

if (location != null) {
Toast.makeText(getBaseContext(), "Location change : Lat: "+location.getLatitude()+
"Lng: "+location.getLongitude(), Toast.LENGTH_SHORT).show();

mDefPoint = new GeoPoint((int)(location.getLatitude()*1000000),(int)(location.getLongitude()*1000000));
mapController.animateTo(mDefPoint);
mapController.setCenter(mDefPoint);

// 展示地图
mDefCaption = "Lat: "+location.getLatitude()+
"Lng: "+location.getLongitude();
MyOverLay mo = new MyOverLay();
mo.onTap(mDefPoint, mMapView);
mMapView.getOverlays().add(mo);
}
}

部分代码如上面,通过DDMS发送location是可以收到的,但就是不显示地图,为什么啊? 那位朋友帮忙看看是什么问题,非常感谢。 --------------------编程问答-------------------- androidmanifest.xml文件中添加权限没?

map apikey 获得没? --------------------编程问答-------------------- 你开启的模拟器是带有GOOGLE API的么,如果在真机上,及加了相关的LIB么?
还有就是在androidmanifest.xml里的<aplication>里加了 <uses-library android:name="com.google.android.maps"/>么?
或是你注册了GOOGLE API了没,使用地图还需要注册的。 --------------------编程问答--------------------
引用 2 楼 xuxinyl 的回复:
你开启的模拟器是带有GOOGLE API的么,如果在真机上,及加了相关的LIB么?
还有就是在androidmanifest.xml里的<aplication>里加了 <uses-library android:name="com.google.android.maps"/>么?
或是你注册了GOOGLE API了没,使用地图还需要注册的。




我的也是一样,在模拟器上可以正常显示,在真机上就不行了。 --------------------编程问答-------------------- 权限问题吧 --------------------编程问答-------------------- 一看就是key问题,
补充:移动开发 ,  Android
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,