2

嗨,我已经编写了一个代码来获取纽约的地址,代码如下。

public void onLocationChanged(Location location) {
    // TODO Auto-generated method stub

        txtLocationView.setText("Longitudes: "
                + String.valueOf(location.getLongitude()) + "Latitudes:"
                + String.valueOf(location.getLatitude()));
        Geocoder geoCoder = new Geocoder(this, Locale.ENGLISH);

        try {
            List<Address> addresses = geoCoder.getFromLocation(
                    location.getLatitude(), location.getLongitude(), 10);

            String address = addresses.get(0).getAddressLine(0);
            String city = addresses.get(0).getAddressLine(1);
            String country = addresses.get(0).getAddressLine(2);
            txtAddressView.setText("Address:"  + addresses);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }


    }

但是 tis 返回了一个空地址列表。嗯,正确地通过了地点。什么可能出错?

4

0 回答 0