开发者

android location finder from latitude and longitude

开发者 https://www.devze.com 2023-02-05 05:03 出处:网络
How can we get address or location name from latitude and longitude in android In my application I have s开发者_StackOverflowet of latitude and longitude, But I need an API which will return me the lo

How can we get address or location name from latitude and longitude in android In my application I have s开发者_StackOverflowet of latitude and longitude, But I need an API which will return me the location name corresponding to the latitude and longitude. thanks.


Through Geocoder we can get the location name according to lattitude and longitude

List<Address> addresses = new Geocoder(<CurrentActivityName>.this,Locale.getDefault()).getFromLocation(cur_lat, cur_lon, 1);

          Address addr= addresses.get(0);

          String Country=addr.getCountryName();
          String  State=addr.getSubAdminArea();
          String  City=addr.getLocality();


Gps will not work on emulator... u have to test this on device.

0

精彩评论

暂无评论...
验证码 换一张
取 消