For example: Longitude: 10.123456 Latitude: 20.654321
Get to the actual location according to the above coordinates (do not use Baidu map or the API of the map of Gao de)
The code is as follows:
Put it in latitude and longitude. Public string getaddress (double latitude, double longitude) { geocoder geocoder = new geocoder (this, Locale.getdefault ()); try { List<Address> addresses = Geocoder.getfromlocation (latitude, &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;LONGITUDE,&NBSP;1); if (Addresses.size () > 0) { Address address = Addresses.get (0); string data = address.tostring (); int Startcity = data.indexof ("1:\" ") + " 1:\ "". Length (); int endcity = data.indexof ("\" ", startcity); string city = data.substring (startcity, endcity); int startplace = data.indexof ("feature=") + "feature=". Length (); int endplace = data.indexof (",", startPlace); string place = data.substring (Startplace,&nbsP;endplace); return city + place ; } } catch (ioexception e) { e.printstacktrace (); } return "Get Failed"; }
This article is from the "Mobile Platform Development" blog, make sure to keep this source http://liuxudong1001.blog.51cto.com/10877072/1749869
Android gets the current position based on known latitude and longitude coordinates