0

I am trying to get all the address line of the user using Geocoder but i am gtting the address line along with the feature name and i only wanted to get theaddress line

            Geocoder geocoder;
            List<Address> addresses;
            geocoder = new Geocoder(getApplicationContext(),Locale.getDefault());
            try {
                addresses = geocoder.getFromLocation(Double.parseDouble(Place.getLat()),Double.parseDouble(Place.getLon()),1);

                testPlace.setText(addresses.get(0).getFeatureName()+"\n\n"+addresses.get(0).getAddressLine(0)
                +"\n\n"+"Latitude:  "+ addresses.get(0).getLatitude()+"\n\n"+"Longitude:  "+ addresses.get(0).getLongitude());

            } catch (IOException e) {
                e.printStackTrace();
            };

This is the output Output of the error

Adeel Zaman
  • 23
  • 1
  • 4
  • I think google doesn't provide anything else what you can do alternately is manually remove the feature name from your address line by matching or parsing. – Malik Saifullah Sep 02 '22 at 18:58

0 Answers0