I am using the below code to find the center of the polygon to print some text on the polygon but it doesn't work for polygon that showed in the picture(image link at the end)
private LatLng getPolygonCenterPoint(ArrayList<LatLng> polygonPointsList){
LatLng centerLatLng = null;
LatLngBounds.Builder builder = new LatLngBounds.Builder();
for(int i = 0 ; i < polygonPointsList.size() ; i++)
{
builder.include(polygonPointsList.get(i));
}
LatLngBounds bounds = builder.build();
centerLatLng = bounds.getCenter();
return centerLatLng;
}
HOW TO FIND THE CENTER LATLNG OF POLYGON(as below picture) AND THE LATLNG SHOULD BE INSIDE THE POLYGON.