using Geocoder to return a list of all street names of a selected city in android -
if have city retrieved by:
geocoder gcd = new geocoder(context, locale.getdefault()); address address = gcd.getfromlocation(lat, lng, 1);
is there way list of street names in selected town using google maps api?
update
geocoder gcd = new geocoder(this, locale.getdefault()); list<address> addresses = null; seek { addresses = gcd.getfromlocation(location.getlatitude(), location.getlongitude(), 1); } grab (ioexception e) { // todo auto-generated grab block e.printstacktrace(); } if (addresses.size() > 0) (int = 0; < addresses.get(0).getmaxaddresslineindex(); i++) log.e("afaf", " " + addresses.get(0).getaddressline(i));
this returns (for example): new york, 5th street 3924.and doesn't iterate on city streets.
i think looking this:
getfromlocationname (string locationname, int maxresults)
from docs :
returns array of addresses known describe named location, may place name such "dalvik, iceland", address such "1600 amphitheatre parkway, mount view, ca", airport code such "sfo", etc.. returned addresses localized locale provided class's constructor.
the query block , returned values obtained means of network lookup. results best guess , not guaranteed meaningful or correct. may useful phone call method thread separate primary ui thread.
to street name utilize this(i think know this):
for(int = 0 ; < addresses.size() ; a++){ address address = addresses.get(a); (int = 0; < address.getmaxaddresslineindex(); i++) { // address address.getaddressline(i); } }
hope helps :)
android google-maps-android-api-2
No comments:
Post a Comment