Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List<Location> listLocation = new ArrayList<Location>();
- @Override
- public void onLocationChanged(Location location) {
- LatLng newLocation = new LatLng(location.getLatitude(),
- location.getLongitude());
- gmap.moveCamera(CameraUpdateFactory.newLatLngZoom(newLocation, 16));
- Marker myMarker = gmap.addMarker(new MarkerOptions()
- .position(new LatLng(listLocation.get(
- listLocation.size() - 1).getLatitude(),
- listLocation.get(listLocation.size() - 1)
- .getLongitude())));
- myMarker.remove();
- gmap.addMarker(new MarkerOptions()
- .title(getResources().getString(
- R.string.current_location_found)).snippet(cityName)
- .position(newLocation));
- gmap.addPolyline(new PolylineOptions()
- .add(new LatLng(listLocation.get(listLocation.size() - 1)
- .getLatitude(), listLocation.get(
- listLocation.size() - 1).getLongitude()),
- new LatLng(location.getLatitude(), location
- .getLongitude())).width(3)
- .color(Color.BLUE));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement