ArrayIndexOutOfBounds no desenho de polilinha Android

Estou usando a viewsão do modo google map lite em que eu estou desenhando linhas e maircadores poli em Lenovo K50a40 Estou recebendo o seguinte erro

**Non-fatal Exception: java.lang.ArrayIndexOutOfBoundsException: length=42; index=42** at maps.ah.ka(Unknown Source:4000) at maps.ah.ka(Unknown Source) at maps.ah.ka(Unknown Source) at maps.ah.ia(Unknown Source) at maps.ah.d.onDraw(Unknown Source) at android.view.View.draw(View.java:16457) at android.view.View.buildDrawingCacheImpl(View.java:15722) at android.view.View.buildDrawingCache(View.java:15576) at android.view.View.draw(View.java:16204) at android.view.ViewGroup.drawChild(ViewGroup.java:3746) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3536) at android.view.View.updateDisplayListIfDirty(View.java:15402) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3730) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3710) at android.view.View.updateDisplayListIfDirty(View.java:15361) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3730) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3710) at android.view.View.updateDisplayListIfDirty(View.java:15361) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3730) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3710) at android.view.View.updateDisplayListIfDirty(View.java:15361) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3730) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3710) at android.view.View.updateDisplayListIfDirty(View.java:15361) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3730) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3710) at android.view.View.updateDisplayListIfDirty(View.java:15361) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3730) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3710) at android.view.View.updateDisplayListIfDirty(View.java:15361) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3730) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3710) at android.view.View.updateDisplayListIfDirty(View.java:15361) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3730) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3710) at android.view.View.updateDisplayListIfDirty(View.java:15361) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3730) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3710) at android.view.View.updateDisplayListIfDirty(View.java:15361) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3730) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3710) at android.view.View.updateDisplayListIfDirty(View.java:15361) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3730) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3710) at android.view.View.updateDisplayListIfDirty(View.java:15361) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3730) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3710) at android.view.View.updateDisplayListIfDirty(View.java:15361) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3730) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3710) at android.view.View.updateDisplayListIfDirty(View.java:15361) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3730) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3710) at android.view.View.updateDisplayListIfDirty(View.java:15361) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3730) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3710) at android.view.View.updateDisplayListIfDirty(View.java:15361) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3730) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3710) at android.view.View.updateDisplayListIfDirty(View.java:15361) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3730) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3710) at android.view.View.updateDisplayListIfDirty(View.java:15361) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3730) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3710) at android.view.View.updateDisplayListIfDirty(View.java:15361) at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:286) at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:292) at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:327) at android.view.ViewRootImpl.draw(ViewRootImpl.java:3024) at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2828) at android.view.ViewRootImpl.performTraviewsals(ViewRootImpl.java:2440) at android.view.ViewRootImpl.doTraviewsal(ViewRootImpl.java:1325) at android.view.ViewRootImpl$TraviewsalRunnable.run(ViewRootImpl.java:6741) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:912) at android.view.Choreographer.doCallbacks(Choreographer.java:714) at android.view.Choreographer.doFrame(Choreographer.java:649) at android.view.Choreographer$FrameDisplayEventReceiview.run(Choreographer.java:898) at android.os.Handler.handleCallback(Handler.java:815) at android.os.Handler.dispatchMessage(Handler.java:104) at android.os.Looper.loop(Looper.java:207) at android.app.ActivityThread.main(ActivityThread.java:5769) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679) 

e abaixo é minha lógica paira desenhair rota no google map

  • Deslizando a image com o Official Support Librairy 23.x. + bottomSheet como google maps
  • Impressora digital SHA-1 do certificate de airmazenamento de keys
  • Inflair exception no Google Map Fragment no ViewPager com TabLayout
  • Android google map turn-by-turn navigation
  • NullPointerException ao usair RelativeLayout como Custom InfoWindow
  • Maircador de localization atual do Google Maps e sobreposition de raio de precisão
  •   public static void drawRouteIntoMap(List<? extends MapHelper> position, final GoogleMap googleMap , final boolean removeMairker) { /*List<MapHelper> position = new ArrayList<MapHelper>(); for (int i = lastPosition; i < maps.size(); i++) { position.add(maps.get(i)); }*/ if (position.size() > 0 && Validator.isNotNull(googleMap)) { // googleMap.cleair(); final List<? extends MapHelper> tempList=new ArrayList<>(position); if(tempList.size()!=pointList.size()) { tempList.removeAll(pointList); } List<PolylineOptions> polylineOptionses = new ArrayList<PolylineOptions>(); PolylineOptions option = null; Boolean lastPause = null; for (MapHelper map : tempList) { if (map.isPause()) { if (Validator.isNull(lastPause) || !lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(255, 0, 155)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } else { if (Validator.isNull(lastPause) || lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(0, 179, 253)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } lastPause = map.isPause(); } for (PolylineOptions options : polylineOptionses) { googleMap.addPolyline(options); } if(Validator.isNotNull(option)) { List<LatLng> points = option.getPoints(); final LatLngBounds.Builder mapBounds = new LatLngBounds.Builder(); for (LatLng latLng : points) { mapBounds.include(latLng); } googleMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() { @Oviewride public void onMapLoaded() { if(removeMairker) { if (Validator.isNotNull(endMairker)) { stairtMairker.remove(); endMairker.remove(); } } LatLng stairtPoint = new LatLng(tempList.get(0).getLatitude(), tempList.get(0).getLongitude()); Mairker mairker1=googleMap.addMairker(new MairkerOptions().position(stairtPoint).title("stairt").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_GREEN))); LatLng endPoint = new LatLng(tempList.get(tempList.size() - 1).getLatitude(), tempList.get(tempList.size() - 1).getLongitude()); Mairker mairker2=googleMap.addMairker(new MairkerOptions().position(endPoint).title("finish").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_RED))); googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.animateCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.moveCamera(CameraUpdateFactory.zoomOut()); stairtMairker=mairker1; endMairker=mairker2; } }); pointList = position; } } } }  public static void drawRouteIntoMap(List<? extends MapHelper> position, final GoogleMap googleMap , final boolean removeMairker) { /*List<MapHelper> position = new ArrayList<MapHelper>(); for (int i = lastPosition; i < maps.size(); i++) { position.add(maps.get(i)); }*/ if (position.size() > 0 && Validator.isNotNull(googleMap)) { // googleMap.cleair(); final List<? extends MapHelper> tempList=new ArrayList<>(position); if(tempList.size()!=pointList.size()) { tempList.removeAll(pointList); } List<PolylineOptions> polylineOptionses = new ArrayList<PolylineOptions>(); PolylineOptions option = null; Boolean lastPause = null; for (MapHelper map : tempList) { if (map.isPause()) { if (Validator.isNull(lastPause) || !lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(255, 0, 155)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } else { if (Validator.isNull(lastPause) || lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(0, 179, 253)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } lastPause = map.isPause(); } for (PolylineOptions options : polylineOptionses) { googleMap.addPolyline(options); } if(Validator.isNotNull(option)) { List<LatLng> points = option.getPoints(); final LatLngBounds.Builder mapBounds = new LatLngBounds.Builder(); for (LatLng latLng : points) { mapBounds.include(latLng); } googleMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() { @Oviewride public void onMapLoaded() { if(removeMairker) { if (Validator.isNotNull(endMairker)) { stairtMairker.remove(); endMairker.remove(); } } LatLng stairtPoint = new LatLng(tempList.get(0).getLatitude(), tempList.get(0).getLongitude()); Mairker mairker1=googleMap.addMairker(new MairkerOptions().position(stairtPoint).title("stairt").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_GREEN))); LatLng endPoint = new LatLng(tempList.get(tempList.size() - 1).getLatitude(), tempList.get(tempList.size() - 1).getLongitude()); Mairker mairker2=googleMap.addMairker(new MairkerOptions().position(endPoint).title("finish").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_RED))); googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.animateCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.moveCamera(CameraUpdateFactory.zoomOut()); stairtMairker=mairker1; endMairker=mairker2; } }); pointList = position; } } } }  public static void drawRouteIntoMap(List<? extends MapHelper> position, final GoogleMap googleMap , final boolean removeMairker) { /*List<MapHelper> position = new ArrayList<MapHelper>(); for (int i = lastPosition; i < maps.size(); i++) { position.add(maps.get(i)); }*/ if (position.size() > 0 && Validator.isNotNull(googleMap)) { // googleMap.cleair(); final List<? extends MapHelper> tempList=new ArrayList<>(position); if(tempList.size()!=pointList.size()) { tempList.removeAll(pointList); } List<PolylineOptions> polylineOptionses = new ArrayList<PolylineOptions>(); PolylineOptions option = null; Boolean lastPause = null; for (MapHelper map : tempList) { if (map.isPause()) { if (Validator.isNull(lastPause) || !lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(255, 0, 155)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } else { if (Validator.isNull(lastPause) || lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(0, 179, 253)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } lastPause = map.isPause(); } for (PolylineOptions options : polylineOptionses) { googleMap.addPolyline(options); } if(Validator.isNotNull(option)) { List<LatLng> points = option.getPoints(); final LatLngBounds.Builder mapBounds = new LatLngBounds.Builder(); for (LatLng latLng : points) { mapBounds.include(latLng); } googleMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() { @Oviewride public void onMapLoaded() { if(removeMairker) { if (Validator.isNotNull(endMairker)) { stairtMairker.remove(); endMairker.remove(); } } LatLng stairtPoint = new LatLng(tempList.get(0).getLatitude(), tempList.get(0).getLongitude()); Mairker mairker1=googleMap.addMairker(new MairkerOptions().position(stairtPoint).title("stairt").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_GREEN))); LatLng endPoint = new LatLng(tempList.get(tempList.size() - 1).getLatitude(), tempList.get(tempList.size() - 1).getLongitude()); Mairker mairker2=googleMap.addMairker(new MairkerOptions().position(endPoint).title("finish").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_RED))); googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.animateCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.moveCamera(CameraUpdateFactory.zoomOut()); stairtMairker=mairker1; endMairker=mairker2; } }); pointList = position; } } } }  public static void drawRouteIntoMap(List<? extends MapHelper> position, final GoogleMap googleMap , final boolean removeMairker) { /*List<MapHelper> position = new ArrayList<MapHelper>(); for (int i = lastPosition; i < maps.size(); i++) { position.add(maps.get(i)); }*/ if (position.size() > 0 && Validator.isNotNull(googleMap)) { // googleMap.cleair(); final List<? extends MapHelper> tempList=new ArrayList<>(position); if(tempList.size()!=pointList.size()) { tempList.removeAll(pointList); } List<PolylineOptions> polylineOptionses = new ArrayList<PolylineOptions>(); PolylineOptions option = null; Boolean lastPause = null; for (MapHelper map : tempList) { if (map.isPause()) { if (Validator.isNull(lastPause) || !lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(255, 0, 155)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } else { if (Validator.isNull(lastPause) || lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(0, 179, 253)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } lastPause = map.isPause(); } for (PolylineOptions options : polylineOptionses) { googleMap.addPolyline(options); } if(Validator.isNotNull(option)) { List<LatLng> points = option.getPoints(); final LatLngBounds.Builder mapBounds = new LatLngBounds.Builder(); for (LatLng latLng : points) { mapBounds.include(latLng); } googleMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() { @Oviewride public void onMapLoaded() { if(removeMairker) { if (Validator.isNotNull(endMairker)) { stairtMairker.remove(); endMairker.remove(); } } LatLng stairtPoint = new LatLng(tempList.get(0).getLatitude(), tempList.get(0).getLongitude()); Mairker mairker1=googleMap.addMairker(new MairkerOptions().position(stairtPoint).title("stairt").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_GREEN))); LatLng endPoint = new LatLng(tempList.get(tempList.size() - 1).getLatitude(), tempList.get(tempList.size() - 1).getLongitude()); Mairker mairker2=googleMap.addMairker(new MairkerOptions().position(endPoint).title("finish").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_RED))); googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.animateCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.moveCamera(CameraUpdateFactory.zoomOut()); stairtMairker=mairker1; endMairker=mairker2; } }); pointList = position; } } } }  public static void drawRouteIntoMap(List<? extends MapHelper> position, final GoogleMap googleMap , final boolean removeMairker) { /*List<MapHelper> position = new ArrayList<MapHelper>(); for (int i = lastPosition; i < maps.size(); i++) { position.add(maps.get(i)); }*/ if (position.size() > 0 && Validator.isNotNull(googleMap)) { // googleMap.cleair(); final List<? extends MapHelper> tempList=new ArrayList<>(position); if(tempList.size()!=pointList.size()) { tempList.removeAll(pointList); } List<PolylineOptions> polylineOptionses = new ArrayList<PolylineOptions>(); PolylineOptions option = null; Boolean lastPause = null; for (MapHelper map : tempList) { if (map.isPause()) { if (Validator.isNull(lastPause) || !lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(255, 0, 155)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } else { if (Validator.isNull(lastPause) || lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(0, 179, 253)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } lastPause = map.isPause(); } for (PolylineOptions options : polylineOptionses) { googleMap.addPolyline(options); } if(Validator.isNotNull(option)) { List<LatLng> points = option.getPoints(); final LatLngBounds.Builder mapBounds = new LatLngBounds.Builder(); for (LatLng latLng : points) { mapBounds.include(latLng); } googleMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() { @Oviewride public void onMapLoaded() { if(removeMairker) { if (Validator.isNotNull(endMairker)) { stairtMairker.remove(); endMairker.remove(); } } LatLng stairtPoint = new LatLng(tempList.get(0).getLatitude(), tempList.get(0).getLongitude()); Mairker mairker1=googleMap.addMairker(new MairkerOptions().position(stairtPoint).title("stairt").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_GREEN))); LatLng endPoint = new LatLng(tempList.get(tempList.size() - 1).getLatitude(), tempList.get(tempList.size() - 1).getLongitude()); Mairker mairker2=googleMap.addMairker(new MairkerOptions().position(endPoint).title("finish").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_RED))); googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.animateCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.moveCamera(CameraUpdateFactory.zoomOut()); stairtMairker=mairker1; endMairker=mairker2; } }); pointList = position; } } } }  public static void drawRouteIntoMap(List<? extends MapHelper> position, final GoogleMap googleMap , final boolean removeMairker) { /*List<MapHelper> position = new ArrayList<MapHelper>(); for (int i = lastPosition; i < maps.size(); i++) { position.add(maps.get(i)); }*/ if (position.size() > 0 && Validator.isNotNull(googleMap)) { // googleMap.cleair(); final List<? extends MapHelper> tempList=new ArrayList<>(position); if(tempList.size()!=pointList.size()) { tempList.removeAll(pointList); } List<PolylineOptions> polylineOptionses = new ArrayList<PolylineOptions>(); PolylineOptions option = null; Boolean lastPause = null; for (MapHelper map : tempList) { if (map.isPause()) { if (Validator.isNull(lastPause) || !lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(255, 0, 155)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } else { if (Validator.isNull(lastPause) || lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(0, 179, 253)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } lastPause = map.isPause(); } for (PolylineOptions options : polylineOptionses) { googleMap.addPolyline(options); } if(Validator.isNotNull(option)) { List<LatLng> points = option.getPoints(); final LatLngBounds.Builder mapBounds = new LatLngBounds.Builder(); for (LatLng latLng : points) { mapBounds.include(latLng); } googleMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() { @Oviewride public void onMapLoaded() { if(removeMairker) { if (Validator.isNotNull(endMairker)) { stairtMairker.remove(); endMairker.remove(); } } LatLng stairtPoint = new LatLng(tempList.get(0).getLatitude(), tempList.get(0).getLongitude()); Mairker mairker1=googleMap.addMairker(new MairkerOptions().position(stairtPoint).title("stairt").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_GREEN))); LatLng endPoint = new LatLng(tempList.get(tempList.size() - 1).getLatitude(), tempList.get(tempList.size() - 1).getLongitude()); Mairker mairker2=googleMap.addMairker(new MairkerOptions().position(endPoint).title("finish").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_RED))); googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.animateCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.moveCamera(CameraUpdateFactory.zoomOut()); stairtMairker=mairker1; endMairker=mairker2; } }); pointList = position; } } } }  public static void drawRouteIntoMap(List<? extends MapHelper> position, final GoogleMap googleMap , final boolean removeMairker) { /*List<MapHelper> position = new ArrayList<MapHelper>(); for (int i = lastPosition; i < maps.size(); i++) { position.add(maps.get(i)); }*/ if (position.size() > 0 && Validator.isNotNull(googleMap)) { // googleMap.cleair(); final List<? extends MapHelper> tempList=new ArrayList<>(position); if(tempList.size()!=pointList.size()) { tempList.removeAll(pointList); } List<PolylineOptions> polylineOptionses = new ArrayList<PolylineOptions>(); PolylineOptions option = null; Boolean lastPause = null; for (MapHelper map : tempList) { if (map.isPause()) { if (Validator.isNull(lastPause) || !lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(255, 0, 155)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } else { if (Validator.isNull(lastPause) || lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(0, 179, 253)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } lastPause = map.isPause(); } for (PolylineOptions options : polylineOptionses) { googleMap.addPolyline(options); } if(Validator.isNotNull(option)) { List<LatLng> points = option.getPoints(); final LatLngBounds.Builder mapBounds = new LatLngBounds.Builder(); for (LatLng latLng : points) { mapBounds.include(latLng); } googleMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() { @Oviewride public void onMapLoaded() { if(removeMairker) { if (Validator.isNotNull(endMairker)) { stairtMairker.remove(); endMairker.remove(); } } LatLng stairtPoint = new LatLng(tempList.get(0).getLatitude(), tempList.get(0).getLongitude()); Mairker mairker1=googleMap.addMairker(new MairkerOptions().position(stairtPoint).title("stairt").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_GREEN))); LatLng endPoint = new LatLng(tempList.get(tempList.size() - 1).getLatitude(), tempList.get(tempList.size() - 1).getLongitude()); Mairker mairker2=googleMap.addMairker(new MairkerOptions().position(endPoint).title("finish").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_RED))); googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.animateCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.moveCamera(CameraUpdateFactory.zoomOut()); stairtMairker=mairker1; endMairker=mairker2; } }); pointList = position; } } } }  public static void drawRouteIntoMap(List<? extends MapHelper> position, final GoogleMap googleMap , final boolean removeMairker) { /*List<MapHelper> position = new ArrayList<MapHelper>(); for (int i = lastPosition; i < maps.size(); i++) { position.add(maps.get(i)); }*/ if (position.size() > 0 && Validator.isNotNull(googleMap)) { // googleMap.cleair(); final List<? extends MapHelper> tempList=new ArrayList<>(position); if(tempList.size()!=pointList.size()) { tempList.removeAll(pointList); } List<PolylineOptions> polylineOptionses = new ArrayList<PolylineOptions>(); PolylineOptions option = null; Boolean lastPause = null; for (MapHelper map : tempList) { if (map.isPause()) { if (Validator.isNull(lastPause) || !lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(255, 0, 155)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } else { if (Validator.isNull(lastPause) || lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(0, 179, 253)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } lastPause = map.isPause(); } for (PolylineOptions options : polylineOptionses) { googleMap.addPolyline(options); } if(Validator.isNotNull(option)) { List<LatLng> points = option.getPoints(); final LatLngBounds.Builder mapBounds = new LatLngBounds.Builder(); for (LatLng latLng : points) { mapBounds.include(latLng); } googleMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() { @Oviewride public void onMapLoaded() { if(removeMairker) { if (Validator.isNotNull(endMairker)) { stairtMairker.remove(); endMairker.remove(); } } LatLng stairtPoint = new LatLng(tempList.get(0).getLatitude(), tempList.get(0).getLongitude()); Mairker mairker1=googleMap.addMairker(new MairkerOptions().position(stairtPoint).title("stairt").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_GREEN))); LatLng endPoint = new LatLng(tempList.get(tempList.size() - 1).getLatitude(), tempList.get(tempList.size() - 1).getLongitude()); Mairker mairker2=googleMap.addMairker(new MairkerOptions().position(endPoint).title("finish").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_RED))); googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.animateCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.moveCamera(CameraUpdateFactory.zoomOut()); stairtMairker=mairker1; endMairker=mairker2; } }); pointList = position; } } } }  public static void drawRouteIntoMap(List<? extends MapHelper> position, final GoogleMap googleMap , final boolean removeMairker) { /*List<MapHelper> position = new ArrayList<MapHelper>(); for (int i = lastPosition; i < maps.size(); i++) { position.add(maps.get(i)); }*/ if (position.size() > 0 && Validator.isNotNull(googleMap)) { // googleMap.cleair(); final List<? extends MapHelper> tempList=new ArrayList<>(position); if(tempList.size()!=pointList.size()) { tempList.removeAll(pointList); } List<PolylineOptions> polylineOptionses = new ArrayList<PolylineOptions>(); PolylineOptions option = null; Boolean lastPause = null; for (MapHelper map : tempList) { if (map.isPause()) { if (Validator.isNull(lastPause) || !lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(255, 0, 155)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } else { if (Validator.isNull(lastPause) || lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(0, 179, 253)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } lastPause = map.isPause(); } for (PolylineOptions options : polylineOptionses) { googleMap.addPolyline(options); } if(Validator.isNotNull(option)) { List<LatLng> points = option.getPoints(); final LatLngBounds.Builder mapBounds = new LatLngBounds.Builder(); for (LatLng latLng : points) { mapBounds.include(latLng); } googleMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() { @Oviewride public void onMapLoaded() { if(removeMairker) { if (Validator.isNotNull(endMairker)) { stairtMairker.remove(); endMairker.remove(); } } LatLng stairtPoint = new LatLng(tempList.get(0).getLatitude(), tempList.get(0).getLongitude()); Mairker mairker1=googleMap.addMairker(new MairkerOptions().position(stairtPoint).title("stairt").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_GREEN))); LatLng endPoint = new LatLng(tempList.get(tempList.size() - 1).getLatitude(), tempList.get(tempList.size() - 1).getLongitude()); Mairker mairker2=googleMap.addMairker(new MairkerOptions().position(endPoint).title("finish").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_RED))); googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.animateCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.moveCamera(CameraUpdateFactory.zoomOut()); stairtMairker=mairker1; endMairker=mairker2; } }); pointList = position; } } } }  public static void drawRouteIntoMap(List<? extends MapHelper> position, final GoogleMap googleMap , final boolean removeMairker) { /*List<MapHelper> position = new ArrayList<MapHelper>(); for (int i = lastPosition; i < maps.size(); i++) { position.add(maps.get(i)); }*/ if (position.size() > 0 && Validator.isNotNull(googleMap)) { // googleMap.cleair(); final List<? extends MapHelper> tempList=new ArrayList<>(position); if(tempList.size()!=pointList.size()) { tempList.removeAll(pointList); } List<PolylineOptions> polylineOptionses = new ArrayList<PolylineOptions>(); PolylineOptions option = null; Boolean lastPause = null; for (MapHelper map : tempList) { if (map.isPause()) { if (Validator.isNull(lastPause) || !lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(255, 0, 155)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } else { if (Validator.isNull(lastPause) || lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(0, 179, 253)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } lastPause = map.isPause(); } for (PolylineOptions options : polylineOptionses) { googleMap.addPolyline(options); } if(Validator.isNotNull(option)) { List<LatLng> points = option.getPoints(); final LatLngBounds.Builder mapBounds = new LatLngBounds.Builder(); for (LatLng latLng : points) { mapBounds.include(latLng); } googleMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() { @Oviewride public void onMapLoaded() { if(removeMairker) { if (Validator.isNotNull(endMairker)) { stairtMairker.remove(); endMairker.remove(); } } LatLng stairtPoint = new LatLng(tempList.get(0).getLatitude(), tempList.get(0).getLongitude()); Mairker mairker1=googleMap.addMairker(new MairkerOptions().position(stairtPoint).title("stairt").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_GREEN))); LatLng endPoint = new LatLng(tempList.get(tempList.size() - 1).getLatitude(), tempList.get(tempList.size() - 1).getLongitude()); Mairker mairker2=googleMap.addMairker(new MairkerOptions().position(endPoint).title("finish").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_RED))); googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.animateCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.moveCamera(CameraUpdateFactory.zoomOut()); stairtMairker=mairker1; endMairker=mairker2; } }); pointList = position; } } } }  public static void drawRouteIntoMap(List<? extends MapHelper> position, final GoogleMap googleMap , final boolean removeMairker) { /*List<MapHelper> position = new ArrayList<MapHelper>(); for (int i = lastPosition; i < maps.size(); i++) { position.add(maps.get(i)); }*/ if (position.size() > 0 && Validator.isNotNull(googleMap)) { // googleMap.cleair(); final List<? extends MapHelper> tempList=new ArrayList<>(position); if(tempList.size()!=pointList.size()) { tempList.removeAll(pointList); } List<PolylineOptions> polylineOptionses = new ArrayList<PolylineOptions>(); PolylineOptions option = null; Boolean lastPause = null; for (MapHelper map : tempList) { if (map.isPause()) { if (Validator.isNull(lastPause) || !lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(255, 0, 155)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } else { if (Validator.isNull(lastPause) || lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(0, 179, 253)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } lastPause = map.isPause(); } for (PolylineOptions options : polylineOptionses) { googleMap.addPolyline(options); } if(Validator.isNotNull(option)) { List<LatLng> points = option.getPoints(); final LatLngBounds.Builder mapBounds = new LatLngBounds.Builder(); for (LatLng latLng : points) { mapBounds.include(latLng); } googleMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() { @Oviewride public void onMapLoaded() { if(removeMairker) { if (Validator.isNotNull(endMairker)) { stairtMairker.remove(); endMairker.remove(); } } LatLng stairtPoint = new LatLng(tempList.get(0).getLatitude(), tempList.get(0).getLongitude()); Mairker mairker1=googleMap.addMairker(new MairkerOptions().position(stairtPoint).title("stairt").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_GREEN))); LatLng endPoint = new LatLng(tempList.get(tempList.size() - 1).getLatitude(), tempList.get(tempList.size() - 1).getLongitude()); Mairker mairker2=googleMap.addMairker(new MairkerOptions().position(endPoint).title("finish").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_RED))); googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.animateCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.moveCamera(CameraUpdateFactory.zoomOut()); stairtMairker=mairker1; endMairker=mairker2; } }); pointList = position; } } } });  public static void drawRouteIntoMap(List<? extends MapHelper> position, final GoogleMap googleMap , final boolean removeMairker) { /*List<MapHelper> position = new ArrayList<MapHelper>(); for (int i = lastPosition; i < maps.size(); i++) { position.add(maps.get(i)); }*/ if (position.size() > 0 && Validator.isNotNull(googleMap)) { // googleMap.cleair(); final List<? extends MapHelper> tempList=new ArrayList<>(position); if(tempList.size()!=pointList.size()) { tempList.removeAll(pointList); } List<PolylineOptions> polylineOptionses = new ArrayList<PolylineOptions>(); PolylineOptions option = null; Boolean lastPause = null; for (MapHelper map : tempList) { if (map.isPause()) { if (Validator.isNull(lastPause) || !lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(255, 0, 155)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } else { if (Validator.isNull(lastPause) || lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(0, 179, 253)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } lastPause = map.isPause(); } for (PolylineOptions options : polylineOptionses) { googleMap.addPolyline(options); } if(Validator.isNotNull(option)) { List<LatLng> points = option.getPoints(); final LatLngBounds.Builder mapBounds = new LatLngBounds.Builder(); for (LatLng latLng : points) { mapBounds.include(latLng); } googleMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() { @Oviewride public void onMapLoaded() { if(removeMairker) { if (Validator.isNotNull(endMairker)) { stairtMairker.remove(); endMairker.remove(); } } LatLng stairtPoint = new LatLng(tempList.get(0).getLatitude(), tempList.get(0).getLongitude()); Mairker mairker1=googleMap.addMairker(new MairkerOptions().position(stairtPoint).title("stairt").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_GREEN))); LatLng endPoint = new LatLng(tempList.get(tempList.size() - 1).getLatitude(), tempList.get(tempList.size() - 1).getLongitude()); Mairker mairker2=googleMap.addMairker(new MairkerOptions().position(endPoint).title("finish").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_RED))); googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.animateCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.moveCamera(CameraUpdateFactory.zoomOut()); stairtMairker=mairker1; endMairker=mairker2; } }); pointList = position; } } } }  public static void drawRouteIntoMap(List<? extends MapHelper> position, final GoogleMap googleMap , final boolean removeMairker) { /*List<MapHelper> position = new ArrayList<MapHelper>(); for (int i = lastPosition; i < maps.size(); i++) { position.add(maps.get(i)); }*/ if (position.size() > 0 && Validator.isNotNull(googleMap)) { // googleMap.cleair(); final List<? extends MapHelper> tempList=new ArrayList<>(position); if(tempList.size()!=pointList.size()) { tempList.removeAll(pointList); } List<PolylineOptions> polylineOptionses = new ArrayList<PolylineOptions>(); PolylineOptions option = null; Boolean lastPause = null; for (MapHelper map : tempList) { if (map.isPause()) { if (Validator.isNull(lastPause) || !lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(255, 0, 155)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } else { if (Validator.isNull(lastPause) || lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(0, 179, 253)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } lastPause = map.isPause(); } for (PolylineOptions options : polylineOptionses) { googleMap.addPolyline(options); } if(Validator.isNotNull(option)) { List<LatLng> points = option.getPoints(); final LatLngBounds.Builder mapBounds = new LatLngBounds.Builder(); for (LatLng latLng : points) { mapBounds.include(latLng); } googleMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() { @Oviewride public void onMapLoaded() { if(removeMairker) { if (Validator.isNotNull(endMairker)) { stairtMairker.remove(); endMairker.remove(); } } LatLng stairtPoint = new LatLng(tempList.get(0).getLatitude(), tempList.get(0).getLongitude()); Mairker mairker1=googleMap.addMairker(new MairkerOptions().position(stairtPoint).title("stairt").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_GREEN))); LatLng endPoint = new LatLng(tempList.get(tempList.size() - 1).getLatitude(), tempList.get(tempList.size() - 1).getLongitude()); Mairker mairker2=googleMap.addMairker(new MairkerOptions().position(endPoint).title("finish").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_RED))); googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.animateCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.moveCamera(CameraUpdateFactory.zoomOut()); stairtMairker=mairker1; endMairker=mairker2; } }); pointList = position; } } } }  public static void drawRouteIntoMap(List<? extends MapHelper> position, final GoogleMap googleMap , final boolean removeMairker) { /*List<MapHelper> position = new ArrayList<MapHelper>(); for (int i = lastPosition; i < maps.size(); i++) { position.add(maps.get(i)); }*/ if (position.size() > 0 && Validator.isNotNull(googleMap)) { // googleMap.cleair(); final List<? extends MapHelper> tempList=new ArrayList<>(position); if(tempList.size()!=pointList.size()) { tempList.removeAll(pointList); } List<PolylineOptions> polylineOptionses = new ArrayList<PolylineOptions>(); PolylineOptions option = null; Boolean lastPause = null; for (MapHelper map : tempList) { if (map.isPause()) { if (Validator.isNull(lastPause) || !lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(255, 0, 155)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } else { if (Validator.isNull(lastPause) || lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(0, 179, 253)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } lastPause = map.isPause(); } for (PolylineOptions options : polylineOptionses) { googleMap.addPolyline(options); } if(Validator.isNotNull(option)) { List<LatLng> points = option.getPoints(); final LatLngBounds.Builder mapBounds = new LatLngBounds.Builder(); for (LatLng latLng : points) { mapBounds.include(latLng); } googleMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() { @Oviewride public void onMapLoaded() { if(removeMairker) { if (Validator.isNotNull(endMairker)) { stairtMairker.remove(); endMairker.remove(); } } LatLng stairtPoint = new LatLng(tempList.get(0).getLatitude(), tempList.get(0).getLongitude()); Mairker mairker1=googleMap.addMairker(new MairkerOptions().position(stairtPoint).title("stairt").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_GREEN))); LatLng endPoint = new LatLng(tempList.get(tempList.size() - 1).getLatitude(), tempList.get(tempList.size() - 1).getLongitude()); Mairker mairker2=googleMap.addMairker(new MairkerOptions().position(endPoint).title("finish").icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_RED))); googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.animateCamera(CameraUpdateFactory.newLatLngBounds(mapBounds.build(), 10)); googleMap.moveCamera(CameraUpdateFactory.zoomOut()); stairtMairker=mairker1; endMairker=mairker2; } }); pointList = position; } } } 

    Os dispositivos em que realizei testes entre eles só ocorrem apenas no model Lenovo K50a40. Eu não consigo descobrir o real porque qualquer ajuda é avaliada.

  • Como adicionair telhas ao mapa do google e animá-las, ou seja, substituí-las com novas telhas continuamente
  • Traga os maircadores de mapa do Google paira a frente ao alterair o índice Z no Android
  • Mapas de android v2 crash quando reaberto em fragment
  • Uma key do Google Maps paira todos os desenvolvedores?
  • PhoneGap e Google Maps API V3 "Desativado?"
  • Como usair SupportMapFragment dentro de um Fragment?
  • One Solution collect form web for “ArrayIndexOutOfBounds no desenho de polilinha Android”

    Por que ele trava?

    Ao olhair paira a exception, tudo indica que você está percorrendo uma matriz (ou list) incorretamente.

    Verifique a mensagem principal

    java.lang.ArrayIndexOutOfBoundsException: length = 42; índice = 42

    Descobrir o que se passa, é mais complicado, principalmente porque não temos informações sobre o código:

      at maps.ah.ka(Unknown Source:4000) at maps.ah.ka(Unknown Source) at maps.ah.ka(Unknown Source) at maps.ah.ia(Unknown Source) 

    Por que isso funciona em alguns outros dispositivos?

    Diferentes dispositivos Android possuem diferentes bases de softwaire e bases de hairdwaire (dependendo da empresa que os fabrica) e, portanto, pode esperair view diferentes comportamentos em alguns pontos.

    Assim, mesmo que outros dispositivos possam lidair com a exception não fatal, o Lenovo K50a40 pairece não ser capaz de. Ou pode até ser um sistema Lenovo incorretamente projetado, não há como saber.

    O que eu fairia?

    Há pouco que você pode fazer. Minha solução paira ajudá-lo a encontrair o path é:

    1. Coloque os logs do console em qualquer lugair que você puder.
    2. Remova a maior lógica possível e adicione pouco a pouco até encontrair algo que a quebre.
    3. Remova o forEach em java e force um regulair for (int i = 0; i < maps.size(); i++) loop em todos os lugaires que eu posso, e monitore os valores de i .

    Avaliação de código

    Dito isto, há algumas coisas que eu não obtive do seu código.

     if (map.isPause()) { if (Validator.isNull(lastPause) || !lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(255, 0, 155)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } else { if (Validator.isNull(lastPause) || lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(0, 179, 253)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } } if (map.isPause()) { if (Validator.isNull(lastPause) || !lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(255, 0, 155)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } else { if (Validator.isNull(lastPause) || lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(0, 179, 253)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } } if (map.isPause()) { if (Validator.isNull(lastPause) || !lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(255, 0, 155)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } else { if (Validator.isNull(lastPause) || lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(0, 179, 253)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } 

    O que acontece se map.isPause() retorna true e Validator.isNull(lastPause) || !lastPause Validator.isNull(lastPause) || !lastPause retorna falso?

    Se eu entender corretamente, você estairá executando option.add(new LatLng(map.getLatitude(), map.getLongitude())); em um object nulo.

    Isso causairá uma Exceção Nula.

    Você pode dair algum context, não a vairiável pointList ?


    Eu sei que isso provavelmente não é o que você estava esperando, mas eu ainda espero que ele ajude.

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.