Android google maps. Add marker by address -
Android google maps. Add marker by address -
i added map in android application , want add together marker on map address. possible? tried long , lat geocoder
, there error service not available
.
my code:
geocoder geocoder = new geocoder(getbasecontext()); list<address> addresses = null; seek { addresses = geocoder.getfromlocationname(event.getplace(), 20); system.out.println(addresses); // (int = 0; < addresses.size(); i++) { // multiple matches // // address addr = addresses.get(i); // // double latitude = addr.getlatitude(); // double longitude = addr.getlongitude(); // // // values // // system.out.println(latitude); // system.out.println(longitude); // // } } grab (ioexception e) { // todo auto-generated grab block e.printstacktrace(); }
it possible. problem seems geocoding part.
the problem utilize of geocoder requires backend service not included in core android framework, mentioned in android api geocoder. should utilize geocoder.ispresent()
check if functionality available. if not, cannot utilize method.
geocoding can alternatively done google maps using url, described in the google geocoding api. illustration (you need api key):
https://maps.googleapis.com/maps/api/geocode/json?address=1600+amphitheatre+parkway,+mountain+view,+ca&key=api_key
giving result can parsed retrieve latitude , longitude marker.
android google-maps
Comments
Post a Comment