Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. public static void processMap()
  2. {
  3. for (int i = 0; i < lat.size(); i++)
  4. {
  5. MarkerOptions markerOptions = new MarkerOptions();
  6. LatLng latLng = new LatLng(lat.get(i), lng.get(i));
  7.  
  8. markerOptions.position(latLng);
  9. markerOptions.title("title");
  10. markerOptions.snippet("description");
  11.  
  12. mMap.addMarker(markerOptions);
  13. bounds.include(new LatLng(lat.get(i), lng.get(i)));
  14. }
  15.  
  16. mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds.build(), 150));
  17. }
  18.  
  19. public static void processMap()
  20. {
  21. int num = 0;
  22. double lat2 = 0;
  23. double lng2 = 0;
  24.  
  25. for (int l = 0; l < lat.size(); l++)
  26. {
  27. lat2 = lat.get(l);
  28. lng2 = lng.get(l);
  29. LatLng latLng = new LatLng(lat2, lng2);
  30.  
  31. MarkerOptions markerOptions = new MarkerOptions();
  32. markerOptions.position(latLng);
  33. markerOptions.title(title.get(l));
  34. markerOptions.snippet(description.get(l));
  35.  
  36. mMap.addMarker(markerOptions);
  37.  
  38. bounds.include(new LatLng(lat2, lng2));
  39. num++;
  40. }
  41.  
  42. if (num == 1)
  43. {
  44. // if only 1 marker
  45. LatLng latLng2 = new LatLng(lat2, lng2);
  46. mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng2, 16));
  47. }
  48. else
  49. {
  50. // more than 1 marker
  51. mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds.build(), 150));
  52. }
  53. }
  54.  
  55. if (num == 1)
  56. {
  57. // if only 1 marker
  58. mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(bounds.build(), 16));
  59. }
  60. else
  61. {
  62. // more than 1 marker
  63. mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds.build(), 150));
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement