Having an issue with polyline. I have lat n long in main activity. Have to draw a path with given latitude and longitude but couldn't find a proper way to pass the data to polyline. Does Polyline takes array list? plz help me out. a big thank you in advance. Here is the code.
@Override
public void onLocationChanged(Location location) {
latitude = location.getLatitude();
Log.v(TAG, String.valueOf(latitude));
longitude = location.getLongitude();
Log.v(TAG, String.valueOf(longitude));
latLng = new LatLng(latitude,longitude);
myLatLong = new double[]{getLatitude(),getLongitude()};
}
and here is MapsActivity code.
@Override
public void onMapReady(GoogleMap googleMap) {
Polyline polyline1 = googleMap.addPolyline(new PolylineOptions()
.clickable(true)
.add(
new LatLng(-35.016, 143.321),
new LatLng(-34.747, 145.592),
new LatLng(-34.364, 147.891),
new LatLng(-33.501, 150.217),
new LatLng(-32.306, 149.248),
new LatLng(-32.491, 147.309)));
}