0
{ @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); 
}} 
+0

[計算兩個緯度經度點之間的距離? (Haversine公式)](https://stackoverflow.com/questions/27928/calculate-distance-between-two-latitude-longitude-points-haversine-formula) – Simo

+0

是的,但placepicker只是有getlatlang()merthod,如何只能從地方選擇器中獲得成功和失敗?請幫幫我 –

回答

0

從PlacePicker你LatLang喜歡

final LatLng location = place.getLatLng(); 

,比你可以得到緯度和經度來自LatLng like

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

請參閱this瞭解更多信息。

相關問題