Kotlin Android Google Map Search Location
In this tutorial, we will implement search location functionality in Google Map. The searching of Google location is done through Geocoder class. Geocoder class facilitates the 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 the street address.
Methods of Geocoder class
Add the following code in an activity_maps.xml layout file. The EditText is used to input search location and Button is used for click event to search the place.
Add the Google Map Service and Google Location Service dependencies in build.gradle file.
Place the Google Map API key in res/values/google_map_api.xml file.
Add the following code in MapsActivity.kt class file.
Note: Check it on the real Android device for the best result of output.