How to Sort Geo-points according to the distance from current location in Android

前端 未结 4 1981
星月不相逢
星月不相逢 2020-12-04 20:44

I have a \"Place\" object with a LatLng coordinate for each:

import com.google.android.gms.maps.model.LatLng;

public class Place{
    public String name;
           


        
4条回答
  •  星月不相逢
    2020-12-04 20:58

    you can use the

    distanceInMeters = (loc1.distanceTo(loc2));
    

    from google maps API and then add the results to the Key in a TreeMap

提交回复
热议问题