Start a Project

Getting Longitude and Latitude from Address

Lat. long. from address

There are many scenarios in Android development when you need GPS location, address and what not in your android application. For all theses android had provided many things like google Maps library, Geocoder etc. But if you need is the smallest one then using a full fledged library for it. So here we will discuss how can we get the longitude and latitude of an address from address string with the help of a simple google map API. It is the simplest and most effective way as it doesn’t need us to add the library only one API will do it.

So lets start, firstly by overriding the toString() method for our own Address.java model so that we can get the address in string representation.

Now as we have the Address object converted to string, lets move on to our next and final step i.e. getting longitude and latitude from this address.

 

Exit mobile version