Reputation: 10533
Let's say the user selects "Starbucks" from a dropdown list in the first step, now i want to show a MapView and list all Starbucks around user's location (which i already know). Now, is there any way to pass that "starbucks" to the appropriate component (Geocoder
?) to start a search without any user interaction?
I could't find any tutorial or sample code so an approach how to solve it (if possible at all) will be highly appreciated.
Upvotes: 1
Views: 1589
Reputation: 16110
well you need to manually draw the itemOverlays on the map based on the distance between your location and the item's location. you can get that one easely with the location object's distanceBetween method. assuming you know how to draw overlays on the map the only thing left would be to get a source consisted of names and locations (can be a local database, webservice, geocoder etc).
thats the process, now about the datasource, try to find some online geocoder that you can use or there is one in the android sdk that is actually the google maps geocoder which last time i checked was really poorly documented but if you try hard enough to make it work it is certanly good.
At least from the geocoder or reverseGeocoder (the one is coordinates to address, the other one address to coordinates) you get a list of locations matching your search, so check that one and show the appropriate locations on the map.
Just for a reference there is the Google maps geocoder which is in the sdk, there is Cloudmade which also has an api you can access for geocoding, but no free sdk for use so you will need to parse things yourself,
there is also the yahoo maps geocoder api which you can also use for this.
that's as far as i know.
Upvotes: 2