我正在实施MapsActivity
和PlacePicker
。我已将Placepicker
实施方法放在getMapReady
函数中。
当我运行它时,首先是一个placepicker来请求选择某个位置然后它进入mylocation而不是placepicker选择的位置。
任何人都有这个想法
我试过LatLngBounds
但没有成功。谢谢。
答案 0 :(得分:1)
我希望你尝试过如下:
int PLACE_PICKER_REQUEST = 1;
PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();
startActivityForResult(builder.build(this), PLACE_PICKER_REQUEST);
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == PLACE_PICKER_REQUEST) {
if (resultCode == RESULT_OK) {
Place place = PlacePicker.getPlace(data, this);
String toastMsg = String.format("Place: %s", place.getName());
Toast.makeText(this, toastMsg, Toast.LENGTH_LONG).show();
// Here, get the position of the place, mark it in map and moveCamera to that, couple lines of code.
}
}
}