Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2014
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. List<Location> listLocation = new ArrayList<Location>();
  2.  
  3. @Override
  4. public void onLocationChanged(Location location) {
  5. LatLng newLocation = new LatLng(location.getLatitude(),
  6. location.getLongitude());
  7. gmap.moveCamera(CameraUpdateFactory.newLatLngZoom(newLocation, 16));
  8.  
  9. Marker myMarker = gmap.addMarker(new MarkerOptions()
  10. .position(new LatLng(listLocation.get(
  11. listLocation.size() - 1).getLatitude(),
  12. listLocation.get(listLocation.size() - 1)
  13. .getLongitude())));
  14. myMarker.remove();
  15.  
  16. gmap.addMarker(new MarkerOptions()
  17. .title(getResources().getString(
  18. R.string.current_location_found)).snippet(cityName)
  19. .position(newLocation));
  20.  
  21. gmap.addPolyline(new PolylineOptions()
  22. .add(new LatLng(listLocation.get(listLocation.size() - 1)
  23. .getLatitude(), listLocation.get(
  24. listLocation.size() - 1).getLongitude()),
  25. new LatLng(location.getLatitude(), location
  26. .getLongitude())).width(3)
  27. .color(Color.BLUE));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement