Android基于高德地图poi的仿微信获取位置功能实例代码

  

1。打开页面自动定位,同时搜索周边所有poi

  

 Android基于高德地图poi的仿微信获取位置功能实例代码

  

2。点击搜索按钮,输入关键子,获取关键字搜索结果

  

 Android基于高德地图poi的仿微信获取位置功能实例代码

  

3。选取listview中的一项即可定位到该位置,或者获取任何消息

  

 Android基于高德地图poi的仿微信获取位置功能实例代码

  

4。文件类

  

1, MapActivity         公共类实现PoiSearch MapActivity延伸活动。OnPoiSearchListener {   私人MapView mMapView=零;   私人同理同理;   私人MyLocationStyle MyLocationStyle;//poiSearch相关   私人PoiSearch PoiSearch;   私人PoiSearch。查询查询;   布尔isPoiSearched=false;//是否进行poi搜索//列表视图   私人ListView会;   ArrayListarrayList;   MyAdpter适配器;   MyHandler MyHandler;//字体   字体特遣部队;//搜索栏   FrameLayout FrameLayout;   ImageView searchIv;   EditText searchEt;   TextView标题;   按钮btn;   ImageView成功;   布尔”,0,currentInfo.get (“cityCode”),真正的);//==41.652146=123.427205 # #经度纬度省辽宁省#城市=沈阳市#区=浑南区# # adCode cityCode=024=210112 #地址=辽宁省沈阳市浑南区创新一路靠近东北大学浑南校区#国家=中国#路=创新一路# poiName=东北大学浑南校区#街=创新一路# streetNum=193号# aoiName=东北大学浑南校区# poiid=#楼=# errorCode=0 # errorInfo=成功# locationDetail=24 # csid: 1 cce9508143d493182a8da7745eb07b3 # locationType=5   }   }   });   }   @Override   公共布尔>   & lt; & # 63; xml version=" 1.0 " encoding=" utf - 8 " & # 63;比;   & lt; LinearLayout xmlns: android=" http://schemas.android.com/apk/res/android "   xmlns:工具=" http://schemas.android.com/tools "   android: layout_width=" match_parent "   android: layout_height=" match_parent "   android:背景=" # e9e7ef”   android:取向=按怪薄?   工具:上下文=癱om.hzstz.mymanager.MapActivity”比;   LinearLayout & lt;   android: layout_width=" match_parent "   android: layout_height=" 50 dp”   android: layout_weight=" 1 "   android:背景=" # 009 dff "   面向android:="水平"比;   & lt; ImageView   android: id=癅 + id/回来”   android: layout_width=" 30 dp "   android: layout_height=" 25 dp "   android: layout_gravity=" center_vertical "   android: layout_weight=" 6 "   左/android: src=" https://www.yisu.com/zixun/@drawable "/比;   & lt; TextView   android: id=癅 + id/标题”   android: layout_width=" wrap_content "   android: layout_height=" match_parent "   android: layout_weight=" 80 "   android:重力="中心"   android:文本=" @string/app_name”   android:输入textColor=" # 000 "   android: textSize=" 25 dp "   android:可见性=翱杉?祝辞   & lt; FrameLayout   android: id=癅 + id/searchLayout”   android: layout_width=" wrap_content "   android: layout_height=" match_parent "   android: layout_weight=?”比;   EditText & lt;   android: id=癅 + id/search_input”   android: layout_width=" match_parent "   android: layout_height=" 40 dp "   android: layout_gravity=" center_vertical "   android: layout_marginTop=" 2 dp "   android:提示=" @string/app_name”   android: paddingStart=" 40 dp "   android:可见性="了"/比;   & lt; ImageView   android: id=癅 + id/搜索”   android: layout_width=" 35 dp”   android: layout_height=" 35 dp”   android: layout_gravity=" center_vertical "   android: paddingStart=" 10 dp”   android: src=" https://www.yisu.com/zixun/@drawable搜索”/比;   & lt;/FrameLayout>   & lt;按钮   android: id=癅 + id/search_go_btn”   android: layout_width=" wrap_content "   android: layout_height=" match_parent "   android:背景=" @drawable/cling_button_normal”   android:文本="搜索”   android:输入textColor=" # fff”   android:可见性="了"/比;   & lt; ImageView   android: id=癅 + id/成功”   android: layout_width=" 30 dp "   android: layout_height=" 30 dp "   android: layout_gravity=" center_vertical "   android: layout_margin=" 5 dp "   android: layout_weight=" 1 "   android: src=" https://www.yisu.com/zixun/@drawable是”   android:可见性=翱杉?祝辞   & lt;/LinearLayout>   & lt; com.amap.api.maps.MapView   android: id=癅 + id/地图”   android: layout_width=" match_parent "   android: layout_height=" 750 dp”   android: layout_weight=" 100 "/比;   & lt;列表视图   android: id=癅 + id/我”   android: layout_width=" match_parent "   android: layout_height=" wrap_content "   android: layout_weight=" 90 "   android:背景=" # ffffff "/比;   & lt;/LinearLayout>

Android基于高德地图poi的仿微信获取位置功能实例代码