Javatpoint Logo
Javatpoint Logo

Android Google Map Search Location using Geocoder

In the previous tutorial of Android Google Map and Android Google Map Displaying Current Location we described about display basic Google Map and current location respectively.

Now in this tutorial we will implement location search functionality in Google Map.

Searching location in Google Map API is done through Geocoder class. Geocoder class is used to handle geocoding and reverse geocoding.

Geocoding is a process in which street address is converted into a coordinate (latitude,longitude). Reverse geocoding is a process in which a coordinate (latitude,longitude) is converted into an address.

Methods of Geocoder class

  1. List<Address> getFromLocation(double latitude, double longitude, int maxResults): This method returns an array of Address which specifies the surrounding latitude and longitude.
  2. List<Address> getFromLocationName(String location, int results, double leftLatitude, double leftLongitude, double rightLatitude, double rightLongitude): This method returns an array of Address which describes the given location such as place, an address, etc.
  3. List<Address> getFromLocationName(String location, int results): This method returns an array of Address which describes te given location such as place, an address, etc.
  4. static boolean isPresent(): This method returns true if the methods getFromLocation() and getFromLocationName() are implemented.

Let's see the code which convert location name into coordinate.

Example of Android Google Map API Searching Location

Let's see an example of Google Map which search input location.


Add a fragment (SupportMapFragment), EditText and Button in activity_maps.xml file.


Add the following dependencies in build.gradel file.

Add the following code in file.

Required Permission in AndroidManifest.xml

Add the following user-permission in AndroidManifest.xml file.



android Search Location 1
android Search Location 2
android Search Location 3

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA