我检查了一堆PlacePicker问题,他们似乎都使用了API密钥。我不认为这是我的问题,因为我能够在地图上成功选择我附近的地点,但是一旦我点击搜索按钮并按任意键,搜索就会关闭。
以下是我的活动的PlacePicker代码
{ "val" : 1, "val2" : 1 }
这是我的清单。我的PlacePicker的搜索功能之前一直在运行,直到我开始尝试集成Firebase。
placeHeading = (EditText)findViewById(R.id.schools_list);
placeHeading.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
getGeo();
} catch (GooglePlayServicesNotAvailableException e) {
e.printStackTrace();
} catch (GooglePlayServicesRepairableException e) {
e.printStackTrace();
}
}
});
}
int PLACE_PICKER_REQUEST = 1;
public void getGeo() throws GooglePlayServicesNotAvailableException, GooglePlayServicesRepairableException {
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());
placeHeading.setText(place.getName());
Toast.makeText(this, toastMsg, Toast.LENGTH_LONG).show();
}
}
}