2017-08-23 65 views
0

我的代碼是這樣的。它工作正常。
我怎麼能在PlacePicker.IntentBuilder設置緯度經度,這樣我可以看到在地圖中的位置我可以在PlacePicker.IntentBuilder中設置LatLngObject以在地圖中看到該地點嗎?

try { 
      PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();     
      Intent intent = builder.build(MainActivity.this); 
      startActivityForResult(intent, PLACE_PICKER_REQUEST_CODE); 
     } catch (GooglePlayServicesRepairableException 
       | GooglePlayServicesNotAvailableException e) { 
      e.printStackTrace(); 
     } 
    @Override 
    protected void onActivityResult(int requestCode, int resultCode, Intent data) { 
if (requestCode == PLACE_PICKER_REQUEST_CODE) { 
      final Place place = PlacePicker.getPlace(this, data); 
      final CharSequence name = place.getName(); 
      final CharSequence address = place.getAddress(); 
      Khet_Location = address.toString(); 
      Place_Name = name + "," + address; 
      String attributions = (String) place.getAttributions(); 
      if (attributions == null) { 
       attributions = ""; 
      } 
      current_location_id.setVisibility(View.VISIBLE); 
      current_location_id.setText(Place_Name); 
      Double latitude = place.getLatLng().latitude; 
      Double longitude = place.getLatLng().longitude; 
      Address_lat = String.valueOf(latitude); 
      Address_long = String.valueOf(longitude); 
     }else 
      super.onActivityResult(requestCode, resultCode, data); 
    } 

請幫助我。

回答

0

你意味着集中所有的地方採摘,我不十分了解你的問題......

但檢查this...

setLatLngBounds(的LatLngBounds的LatLngBounds)

例如

for i to n{ 
    array coords 
    add in LatLngBounds 
} 
placepicker.setLatLngBounds(latLngBounds) 
相關問題