@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是可以收到的,但就是不显示地图,为什么啊? 那位朋友帮忙看看是什么问题,非常感谢。

解决方案 »

  1.   

    androidmanifest.xml文件中添加权限没?map apikey 获得没?
      

  2.   

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