如何计算两点的距离,A点是用户位置,B点是Placepicker.getlatlang()

how to calculate distance from two point, point A is user location, and point B is Placepicker.getlatlang()

{    @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    if (requestCode == Place_Picker_Request){
        place_Picket = PlacePicker.getPlace(data,this);
        String nama = String.format("%s",place_Picket.getName());
        _txplaceName.setText("Name : "+nama);
        String address = String.format("%s",place_Picket.getAddress());
        _txplaceAddres.setText("Addres : "+address);
        String latlang = String.format("%s",place_Picket.getLatLng());
        _txplacePhoneNumber.setText("LatLng :"+latlang);

        "I will calculate distance betwen my location with latlang from placepicker"
        "and show in toast"


        Toast.makeText(MainActivity.this,"",Toast.Length_short).show();
        String url = String.format("%s",place_Picket.getWebsiteUri());
        _txplaceWebsite.setText("Alamat Website : "+url);


    }
    super.onActivityResult(requestCode, resultCode, data);
}}

从 PlacePicker 获取 LatLng luke

final LatLng location = place.getLatLng();

然后您可以从 LatLng 中获取纬度和经度,例如

double lat = LatLng.latitude;
double lng = LatLng.longitude;

有关更多信息,请参阅 this