I am trying to create a list of arraylist in android. Here is my expected formate.
[[90.35911560058594, 23.762723181676783],
[90.36435127258301, 23.764608467290504],
[90.36520957946776, 23.764922678903957],
[90.36606788635254, 23.76327305946888],
[90.36941528320312, 23.763901488386157],
[90.3706169128418, 23.76445136119925],
[90.36735534667969, 23.772070788117777],
[90.3665828704834, 23.77324901017239],
[90.3614330291748, 23.773327557929896],
[90.35877227783203, 23.76979286188437],
[90.35911560058594, 23.76979286188437]]
I used two lists List<Double> nodes = new ArrayList<>() and List<List<Double>> list = new ArrayList<List<Double>>(). Then I added the followings
nodes.add(latLng.longitude);
nodes.add(latLng.latitude);
list.add(nodes);
But this is showing the following output,
Coordinate_List: [81.5364906191826, 56.07605883895308, 86.5351914614439, 61.56546071581482, 94.52162001281975, 59.151354552315375]
All elements are showing in one arraylist. But I need to show this one -
[[90.35911560058594, 23.762723181676783],
[90.36435127258301, 23.764608467290504]]
Can anyone please suggest me possible ways to do this?
nodesarraylist for each pair of co-ordinates?