android开发的时候,我的百度地图能定位,但是我想获取定位到的坐标却失败,为什么

locationListener=new LocationListener() {
public void onLocationChanged(Location location) {
if(location != null){
point1=new GeoPoint((int)(location.getLatitude()*1e6),(int)(location.getLongitude()*1e6));
//mSearch.reverseGeocode(point1);
mMapView.getController().animateTo(point1);
}
}
这个point1 这个点我想直接用,在这个点上加自定义的图片,但是一用就报错,空指针异常,但是地图已经定位到我当前的位置了啊!!!妈蛋要疯了好吗!!! 。。谁知道为什么啊!!!求大神就啊好吗。。。。。T T

第1个回答  2013-07-12
你能确定这个空指针异常是point1抛出的吗?看你的代码,你的point1是new出来,不可能抛空指针异常。你最好认真检查一下,mMapView是不是为null,或者mMapView.getController()是不是为null?
相似回答