首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

android应用百度地图获取自己所在的城市名

2012-06-27 
android使用百度地图获取自己所在的城市名在onLocationChanged方法里获得自己当前的坐标然后方法里写 mSea

android使用百度地图获取自己所在的城市名
在onLocationChanged方法里获得自己当前的坐标
然后方法里写 mSearch.reverseGeocode(new GeoPoint((int)(location.getLatitude()*1e6),(int)(location.getLongitude()*1e6)));
然后再通过代码实行这个方法功能
public class MySearchListener implements MKSearchListener {
public void onGetAddrResult(MKAddrInfo result, int error){
MKGeocoderAddressComponent kk=result.addressComponents;
String city=kk.city;




city就是你所在城市

热点排行