Guest User

Untitled

a guest
Dec 12th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. // this throws a "newLatLngBounds, int) exception" error on line 14
  2. mMap = googleMap;
  3. ArrayList<MyPoint> points = Data.getPoints();
  4. LatLngBounds.Builder builder = new LatLngBounds.Builder();
  5. PolylineOptions polylineOptions = new PolylineOptions();
  6. for (int i = 0; i < points.size(); i++) {
  7. MyPoint point = points.get(i);
  8. polylineOptions.add(new LatLng(point.getLat(), point.getLng()));
  9. builder.include(new LatLng(point.getLat(),point.getLng()));
  10. }
  11. Polyline polyline = mMap.addPolyline(polylineOptions);
  12.  
  13. LatLngBounds bounds = builder.build();
  14. mMap.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 20));
  15.  
  16.  
  17.  
  18. // and pointLatLang is an unresolved symbol
  19. @Override
  20. public void onMapReady(GoogleMap googleMap) {
  21. mMap = googleMap;
  22. ArrayList<MyPoint> points = Data.getPoints();
  23. LatLngBounds.Builder builder = new LatLngBounds.Builder();
  24. PolylineOptions polylineOptions = new PolylineOptions();
  25. for (int i = 0; i < points.size(); i++) {
  26. MyPoint point = points.get(i);
  27. polylineOptions.add(new LatLng(point.getLat(), point.getLng()));
  28. builder.include(pointLatLng);
  29. }
  30. Polyline polyline = mMap.addPolyline(polylineOptions);
  31.  
  32.  
  33. LatLngBounds bounds = builder.build();
  34. mMap.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 20));
  35. }
Add Comment
Please, Sign In to add comment