Kotlin Android Google Map Search LocationIn the previous tutorial, we build the application that locate the Map Fixed Location and Map Current 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
activity_maps.xmlAdd 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. build.gradleAdd the Google Map Service and Google Location Service dependencies in build.gradle file. strings.xmlgoogle_map_api.xmlPlace the Google Map API key in res/values/google_map_api.xml file. MapsActivity.ktAdd the following code in MapsActivity.kt class file. AndroidManifest.xmlOutput: Note: Check it on the real Android device for the best result of output.![]() ![]()
Next Topic#
|