Please Help me,
I have stored my lat, long value into arrayList<String>
, but I'm not able to add it to new LatLng class.
I have to fetch Lat, Long value by json
and add it to (String) ArrayList<String>
.
I want to add my all ArrayList Lat, Long into latlng class, where i can see it using polyline.
But i'm able to get one lat and long and it shows in my google map. But i'm
not able to get all ArrayList
value.
I tried many times. And How to Measure Distance By Lat and Long
Below is my code;
ArrayList<String> arr;
if(b!=null){
arr = (ArrayList<String>)b.getStringArrayList("array_list");
// System.out.println(arr);
}
String s=arr.toString();
System.out.println(s.substring(1, s.length()-1));
String ss=s.substring(1,s.length()-1);
System.out.println(ss);
d=ss.split(",");
for (int i=0;i<d.length;i++){
if(i%2==0){
dd=d[i];
System.out.println(dd +"all even");
}else{
nd=d[i];
System.out.println(nd +"all odd");
}
}
List<LatLng> point = new ArrayList<LatLng>();
double pointY[]={Double.parseDouble(nd)};
double pointX[]={Double.parseDouble(dd)};
for (int i = 0 ; i < pointX.length; i++){
point.add(new LatLng(pointX[i],pointY[i]));
}