+
Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.
This repository was archived by the owner on Aug 23, 2023. It is now read-only.

Geocode for java #310

@panjisadewo

Description

@panjisadewo

I try geocode but i has error like this.
java.io.IOException: Service not Available
2022-10-18 12:30:10.785 4101-4101/? W/System.err: at android.location.Geocoder.getFromLocationName(Geocoder.java:178)

This is my code

    Geocoder geocoder = new Geocoder(getContext(), Locale.getDefault());
    List<Address> addresses;;
    try {
        addresses = geocoder.getFromLocation(-6.193479061, 106.848579406, 10);
        if(addresses.size() > 0){
            String cityName = addresses.get(0).getCountryName();
            String stateName = addresses.get(0).getAddressLine(1);
            String countryName = addresses.get(0).getAddressLine(2);
            Toast.makeText(getActivity(), addresses.size(), Toast.LENGTH_LONG);
        }
    } catch (IOException e) {
        e.printStackTrace();
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载