My Question is i have an Activity of multiple EditText like Street,landmark,Location,City etc. On the Location EditText i put a button to fetch the Current User Location and Fill the User Address in Respective EditText.
NOTE : i Successfully Fetch my current location and populate my location EditText whole but i want to add street Number in Street EditText, City in City EditText etc
Asked
Active
Viewed 188 times
-1

Andrii Omelchenko
- 13,183
- 12
- 43
- 79

techDigi
- 251
- 3
- 18
1 Answers
1
You can use Official Documentation for beginning and find many examples of "reverse geocoding" like this:
Geocoder geocoder;
List<Address> addresses;
geocoder = new Geocoder(this, Locale.getDefault());
addresses = geocoder.getFromLocation(latitude, longitude, 1); // Here 1 represent max location result to returned, by documents it recommended 1 to 5
String address = addresses.get(0).getAddressLine(0); // If any additional address line present than only, check with max available address lines by getMaxAddressLineIndex()
String city = addresses.get(0).getLocality();
String state = addresses.get(0).getAdminArea();
String country = addresses.get(0).getCountryName();
String postalCode = addresses.get(0).getPostalCode();
String knownName = addresses.get(0).getFeatureName(); //
from here

Community
- 1
- 1

Andrii Omelchenko
- 13,183
- 12
- 43
- 79