这是我的代码:
final PolygonOptions options = new PolygonOptions();
options.strokeColor(Color.argb(strokeAlpha, r, g, b));
options.fillColor(Color.argb(fillAlpha, r, g, b));
for (final Punto p : c.getPuntos()) {
options.add(p.getLatLng());
}
map.getMap().addPolygon(options)
我不断收到这个异常:
05-29 11:40:04.531: E/MapScreen_(11196): java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
05-29 11:40:04.531: E/MapScreen_(11196): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251)
05-29 11:40:04.531: E/MapScreen_(11196): at java.util.ArrayList.get(ArrayList.java:304)
05-29 11:40:04.531: E/MapScreen_(11196): at maps.aj.bs.c(Unknown Source)
05-29 11:40:04.531: E/MapScreen_(11196): at maps.aj.bs.o(Unknown Source)
05-29 11:40:04.531: E/MapScreen_(11196): at maps.aj.bq.b(Unknown Source)
05-29 11:40:04.531: E/MapScreen_(11196): at maps.aj.bq.a(Unknown Source)
05-29 11:40:04.531: E/MapScreen_(11196): at maps.aj.al.a(Unknown Source)
05-29 11:40:04.531: E/MapScreen_(11196): at bcn.onTransact(SourceFile:152)
05-29 11:40:04.531: E/MapScreen_(11196): at android.os.Binder.transact(Binder.java:310)
05-29 11:40:04.531: E/MapScreen_(11196): at com.google.android.gms.maps.internal.IGoogleMapDelegate$a$a.addPolygon(Unknown Source)
05-29 11:40:04.531: E/MapScreen_(11196): at com.google.android.gms.maps.GoogleMap.addPolygon(Unknown Source)
05-29 11:40:04.531: E/MapScreen_(11196): at com.cidaut.blueparking.MapScreen.editaCalleEnMapa(MapScreen.java:462)
05-29 11:40:04.531: E/MapScreen_(11196): at com.cidaut.blueparking.MapScreen_.access$21(MapScreen_.java:1)
05-29 11:40:04.531: E/MapScreen_(11196): at com.cidaut.blueparking.MapScreen_$24.run(MapScreen_.java:562)
05-29 11:40:04.531: E/MapScreen_(11196): at android.os.Handler.handleCallback(Handler.java:725)
05-29 11:40:04.531: E/MapScreen_(11196): at android.os.Handler.dispatchMessage(Handler.java:92)
05-29 11:40:04.531: E/MapScreen_(11196): at android.os.Looper.loop(Looper.java:137)
05-29 11:40:04.531: E/MapScreen_(11196): at android.app.ActivityThread.main(ActivityThread.java:5041)
05-29 11:40:04.531: E/MapScreen_(11196): at java.lang.reflect.Method.invokeNative(Native Method)
05-29 11:40:04.531: E/MapScreen_(11196): at java.lang.reflect.Method.invoke(Method.java:511)
05-29 11:40:04.531: E/MapScreen_(11196): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
05-29 11:40:04.531: E/MapScreen_(11196): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
05-29 11:40:04.531: E/MapScreen_(11196): at dalvik.system.NativeStart.main(Native Method)
我真的不明白为什么会发生这种情况。