0

我正在尝试使用 MapMyndia 上的 autosuggest API 获取纬度和经度,但它返回 null

private void callAutoSuggestApi(String searchString) {
        MapmyIndiaAutoSuggest.builder()
                .query(searchString)
                .build()
                .enqueueCall(new Callback<AutoSuggestAtlasResponse>() {
                    @Override
                    public void onResponse(@NonNull Call<AutoSuggestAtlasResponse> call,
                                           @NonNull Response<AutoSuggestAtlasResponse> response) {
                        if (response.code() == 200) {
                            if (response.body() != null) {
                                ArrayList<ELocation> suggestedList = response.body().getSuggestedLocations();
                                
                                if (suggestedList.size() > 0) {
                                    recyclerView.setVisibility(View.VISIBLE);
                                    AutoSuggestAdapter autoSuggestAdapter = new AutoSuggestAdapter(suggestedList, eLocation -> {
                                        Log.e(TAG, "onResponse: " + eLocation.toString());
                                        selectedPlace(eLocation);
                                        recyclerView.setVisibility(View.GONE);
                                    });
                                    recyclerView.setAdapter(autoSuggestAdapter);
                                }
                            } else {
                                showToast("Not able to get value, Try again.");
                            }
                        }
                    }

                    @Override
                    public void onFailure(@NonNull Call<AutoSuggestAtlasResponse> call, @NonNull Throwable t) {
                        showToast(t.toString());
                    }
                });

    }

我得到的输出

ELocation{poiId='GA9HE8', placeAddress='Chamarajanagar District, Karnataka', latitude='null', longitude='null', level=0, type='SUB_DISTRICT', typeX=0, placeName='Yelandur', entryLatitude =null,entryLongitude=null,explore=-1,photoCount=0,user='null',source='null',time=0,index=0,alternateName='',keywords=[],addressTokens=null, p=0, orderIndex=7}

4

0 回答 0