How To Implement A Search For Location In Android?
Basically, on button click, I want the user to input a keyword or an exact location name, and in a listview, I want to show all the locations that match the given keyword within a
Solution 1:
I use to different ways:
1) Android Location Geocoder
Geocodergeocoder=newGeocoder(context);
List<Address> addresses = geocoder.getFromLocationName(locationName, MAX_RESULTS);
2) A HTTP request to the Google Maps Geocode API
HttpGethttpGet=newHttpGet("http://maps.google.com/maps/api/geocode/json?address=" + urlEncodedLocationName +"®ion=" + region + "&language=" + userLanguage);
HttpClientclient=newDefaultHttpClient();
HttpResponseresponse= client.execute(httpGet);
HttpEntityentity= response.getEntity();
Stringresult= EntityUtils.toString(entity, UTF8_CHARSET);
I hope this help you!
Post a Comment for "How To Implement A Search For Location In Android?"