Android Geocoder返回空地址列表

时间:2013-11-01 05:41:59

标签: android

您好我已经编写了一个代码来获取纽约的地址和代码,如下所示。

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返回了一个空地址列表。你正确地通过了locaion。什么可能出错?

0 个答案:

没有答案