I am using for-loop
below. The code calculates correctly if it is not inside the loop, but I want to create a list with no. of distance and time.
KIEL = new LatLng(lat, log);
for(i=0;i<jarray.length;i++){
KIEL = new LatLng(lat, log);
doc = md.getDocument(fromPosition, KIEL,
GMapV2Direction.MODE_DRIVING);
duration = "" + md.getDurationValue(doc);
distance = md.getDistanceText(doc);
HashMap<String, String> map = new HashMap<String, String>();
map.put("distance", distance);
map.put("time", duration );
// // adding HashList to ArrayList
locationlist.add(map);
}
doc
is an object of Document
class which is calculating distance and time between two locations. But when I am using this method inside the loop, it will show no data. How to fix it?