Places API-com.google.android.libraries.places:places:1.1.0自动完成搜索有时出错“无法加载搜索结果”

时间:2019-07-04 12:56:55

标签: android google-places-api

我在我的项目中使用google place api。但是在少数情况下,我没有找到任何结果并收到错误消息“无法加载搜索结果。”我从git下载示例应用程序并遇到了同样的错误。 这是Google API中的错误,或者只是我忘记的Google API控制台设置中的一部分。

 @Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == RESULT_OK) {
        if (requestCode == ON_ACTIVITY_REOPEN) {
            new Handler(Looper.getMainLooper()).postDelayed(() -> {
                listContainer.setVisibility(View.VISIBLE);
                mapContainer.setVisibility(View.GONE);
                fabMapListToggle.setImageResource(R.drawable.mapview_floating);
            }, 350);
            getAllProperties(mySingleton.basicSearchRequest(), false);
        }else if (requestCode == AUTOCOMPLETE_REQUEST_CODE) {
            Place place = Autocomplete.getPlaceFromIntent(data);
                address_txt.setText(place.getName());
                performSearch(place.getName());
            }

    }else if (resultCode == AutocompleteActivity.RESULT_ERROR) {
        // TODO: Handle the error.
        Status status = Autocomplete.getStatusFromIntent(data);
        Toast.makeText(getActivity(), status.toString(), Toast.LENGTH_SHORT).show();

    } else if (resultCode == RESULT_CANCELED) {
        // The user canceled the operation.
    }
}

0 个答案:

没有答案
相关问题