I was having some problem when trying to find the minimum distance and from the minimum distance, I then plot two circles onto the map.
double distance = 0;
double minDistance;
convertedHotSpotGeomList = RetrieveHotSpotAsyncTask.convertedHotSpotGeom;
for(int i = 0; i < convertedHotSpotGeomList.size(); i++){
LatLng point1 = new LatLng(convertedHotSpotGeomList.get(i).getY(), convertedHotSpotGeomList.get(i).getX());
LatLng point2 = new LatLng(convertedHotSpotGeomList.get(++i).getY(), convertedHotSpotGeomList.get(++i).getX());
distance = calculateHotSpot(point1, point2);
Log.i("DIST", String.valueOf(distance));
minDistance = distance;
if(minDistance < distance){
minDistance = distance;
Log.i("MIN", String.valueOf(minDistance));
CircleOptions circleOptions = new CircleOptions()
.center(point1)
.radius(1000)
.fillColor(Color.argb(95, 178, 30, 37))
.strokeColor(Color.TRANSPARENT);
googleBasemap.addCircle(circleOptions);
CircleOptions circleOptions1= new CircleOptions()
.center(point2)
.radius(1000)
.fillColor(Color.argb(95, 88, 130, 37))
.strokeColor(Color.TRANSPARENT);
googleBasemap.addCircle(circleOptions1);
}
}
Currently I am getting 15, 3, 15, 14 as DIST but I could not get the minDist as it is not printed out. Any ideas?
Thanks in advance.