The Google Maps application features a search box (with autosuggestion) that allows you to search for an address, resulting in a marker being placed on the map of the Google Maps application.
Is it possible to re-use this functionality in a custom Android app, where a text box is also presented, resulting in a Geopoint being delivered to the custom app, so that the app itself can place the marker somewhere ? In other words, does the Google Maps application expose a service or an intent that can be used by a custom application ?
If so, how can this integration be done ?
If not, can someone provide a pointer on how a custom implementation can be realized ?
To acquire a location from a named address, you need to use a statement like Geocoder.getLocationFromName("london",5). It will return a set of matches (5 in this example), you can either use the first one, or show a set to the user to select the right one.
http://developer.android.com/reference/android/location/Geocoder.html
Once you have a location (latitude and longitude) you can then plot the location on the map using a MapOverlay, and show the marker using that.
http://developer.android.com/resources/tutorials/views/hello-mapview.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With