0

I am developing Android app in which I am taking destination in edit-text and I want latitude and longitude of that entered location.

example: I have typed in edit-text pune now I want its latitude and longitude.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Sam
  • 1
  • 1

1 Answers1

0

From here : https://stackoverflow.com/a/3574792/2065418

   Geocoder coder = new Geocoder(this);
    List<Address> address;

    try {
        address = coder.getFromLocationName(strAddress,5);
        if (address == null) {
            return null;
        }
        Address location = address.get(0);
        location.getLatitude();
        location.getLongitude();

        p1 = new GeoPoint((int) (location.getLatitude() * 1E6),
                          (int) (location.getLongitude() * 1E6));

         return p1;
    }

strAddress is a string containing the address. The address variable holds the converted addresses.

Community
  • 1
  • 1
Damien R.
  • 3,383
  • 1
  • 21
  • 32