有什么办法可以从地点ID获取经度和纬度?

时间:2019-04-13 08:33:40

标签: android location

目前,我正在使用PlaceAPI库获取位置ID。

objPlacesAPI =  new PlaceAPI.Builder()
                .apiKey("KEY")
                .build(this);

        autoCompleteEditText = (AutoCompleteTextView) findViewById(R.id.autoCompleteEditText);
        autoCompleteEditText.setAdapter(new PlacesAutoCompleteAdapter(this, objPlacesAPI));

        autoCompleteEditText.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Place place = (Place) parent.getItemAtPosition(position);
                autoCompleteEditText.setText(place.getDescription());

                objPlacesAPI.fetchPlaceDetails(place.getId(), new OnPlacesDetailsListener() {
                    @Override
                    public void onError(@NotNull String errorMessage) {
                        String a = "";

                    }

                    @Override
                    public void onPlaceDetailsFetched(@NotNull PlaceDetails placeDetails) {
                        String a = "";
                    }


                });
            }
        });

在上面的代码中,我成功获得了位置,但是我调用了fetchPlaceDetails,但出现错误“无法处理JSON结果”

0 个答案:

没有答案