我在Android中的onLocationChanged事件有问题.这是触发:
case R.id.start: {
Points.add(overlay.getMyLocation()); // Points' type is ArrayList<GeoPoint>
mgr.requestLocationUpdates(best, 0, 3, locationListener);
}
break;
Run Code Online (Sandbox Code Playgroud)
这是onLocationChanged方法:
public void onLocationChanged(Location location) {
i++;
Points.add(overlay.getMyLocation());
MapOverlay mapOverlay = new MapOverlay(Points.get(i-1), Points.get(i));
map.getOverlays().add(mapOverlay); //does the drawing
mMapController.animateTo(Points.get(i));
}
Run Code Online (Sandbox Code Playgroud)
因此,onLocationChanged仅在我按"start"后调用一次.它应该在每次位置发生变化时自动调用,对吗?就我而言,事实并非如此.
请帮我.