intentBuilder를 통해 인 텐트를 생성하여 Google Places API (지역 정보 자동 완성)를 구현하려고합니다. 내 앱이 버튼 클릭으로 의도를 성공적으로 얻었지만 장소를 검색 할 수 없습니다.placesautocomplete result code = 2
onActivityResult를 재정의하면 RESULT_SUCCESS, RESULT_ERROR 또는 RESULT_CANCELLED 대신 resultCode = 2가 발생하고 MainActivity로 돌아옵니다.
나는 여기@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == PLACE_AUTOCOMPLETE_REQUEST_CODE) {
if (resultCode == RESULT_OK) {
Place place = PlaceAutocomplete.getPlace(this, data);
Log.i(TAG, "Place: " + place.getAddress());
} else if (resultCode == PlaceAutocomplete.RESULT_ERROR) {
Status status = PlaceAutocomplete.getStatus(this, data);
// TODO: Handle the error.
Log.i(TAG, status.getStatusMessage());
} else if (resultCode == RESULT_CANCELED) {
Log.i("message", "the user cancelled the operation"); }
}
}
나는 약간의 도움이 필요, 도와주세요 내 코드는 https://developers.google.com/places/android-api/autocomplete 에서 참조를 가져다 종속성
compile 'com.google.android.gms:play-services-places:9.2.0'
을 추가했다.
고맙다. .. Dibyanshu. 나는 지난 2 일 동안 그것을 계산하려고 노력하고 있었다.. 그리고 나는 내가 장소 Api LOL 대신에 Map Api를 가능하게했던 것을 나온다. 너는 내 하루를 구했다. 다시 한번 감사드립니다. :) – Manisha