3

I am drawing multiple polylines using for loop on version 2 google map. I am setting color to the polyline using the code.

mMap.addPolyline(new PolylineOptions()
.add(new LatLng(lats, lons), new LatLng(late,lone))
.width(5)
.color(0xFFFF0000)); 

How to increment the RGB color dynamically for each for loop iteration.

Prabhu M
  • 3,534
  • 8
  • 48
  • 87

1 Answers1

1
  Random rnd = new Random(); 
  int color = Color.argb(255, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256));  
  --- loop ----

   mMap.addPolyline(new PolylineOptions()
  .add(new LatLng(lats, lons), new LatLng(late,lone))
  .width(5)
  .color(color)); 
TheFlash
  • 5,997
  • 4
  • 41
  • 46