private void doDebug() { double slat = 34.103395; double slon = -118.237057; Location loc = new Location( (int) (slat * 1000000), (int) ((slon + 0.01 * debugIdx) * 1000000), "point" + Integer.toString(debugIdx)); LocationModel.getInstance().add("testId", loc); updateLocation("testId"); debugIdx++; }
private void updateLocation(String devId) { LocationModel lm = LocationModel.getInstance(); List<Location> locList = lm.getLocations(devId); Location prevLoc = null; Location currLoc = locList.get(locList.size() - 1); if (locList.size() > 1) { prevLoc = locList.get(locList.size() - 2); GeoPoint p = new GeoPoint(prevLoc.getLatitude(), prevLoc.getLongitude()); prevLocationsOverlay.addItem(p, prevLoc.getInfo(), prevLoc.getInfo()); } MapView mapView = (MapView) findViewById(R.id.mapview); GeoPoint myPoint1 = new GeoPoint(currLoc.getLatitude(), currLoc.getLongitude()); currLocationOverlay.removeAllItems(); currLocationOverlay.addItem(myPoint1, currLoc.getInfo(), currLoc.getInfo()); mapView.getController().setZoom(13); mapView.getController().animateTo(myPoint1); mapView.invalidate(); }