//设置是否显示缩放控件 mMapView.showZoomControls(false);
case R.id.minus_sign: float zoomLevel = mBaiduMap.getMapStatus().zoom; if(zoomLevel>4){ mBaiduMap.setMapStatus(MapStatusUpdateFactory.zoomOut()); minus_sign.setEnabled(true); plus_sign.setEnabled(true); }else{ minus_sign.setEnabled(false); Toast.makeText(MainMap.this, "已经缩至最小!", Toast.LENGTH_SHORT).show(); } break; case R.id.plus_sign: float zoomLeve2 = mBaiduMap.getMapStatus().zoom; if(zoomLeve2<=18){ mBaiduMap.setMapStatus(MapStatusUpdateFactory.zoomIn()); plus_sign.setEnabled(true); minus_sign.setEnabled(true); }else{ Toast.makeText(MainMap.this, "已经放至最大!", Toast.LENGTH_SHORT).show(); plus_sign.setEnabled(false); } break;
public class PoiSearchActivity extends Activity implements OnGetPoiSearchResultListener, OnGetSuggestionResultListener { private PoiSearch mPoiSearch = null;
//创建检索POI实例 mPoiSearch = PoiSearch.newInstance(); //设置POI检索监听者 mPoiSearch.setOnGetPoiSearchResultListener(this);
//发起检索请求 mPoiSearch.searchInCity((new PoiCitySearchOption()) .city(myCity) .keyword(editData) .pageNum(datai++));
@Override protected void onDestroy() { mPoiSearch.destroy(); super.onDestroy(); } @Override public void onGetPoiResult(PoiResult poiResult) { if (poiResult == null || poiResult.error == SearchResult.ERRORNO.RESULT_NOT_FOUND) { Toast.makeText(PoiSearchActivity.this, "未找到结果", Toast.LENGTH_LONG) .show(); return; } if (poiResult.error == SearchResult.ERRORNO.NO_ERROR) { for (int i=0;i<poiResult.getAllPoi().size();i++) { pio=new Pioinfo(); pio.setName(poiResult.getAllPoi().get(i).name); pio.setAddress(poiResult.getAllPoi().get(i).address); pio.setLocation(poiResult.getAllPoi().get(i).location); mList.add(pio); } stopProgressDialog(); dataAdapter.notifyDataSetChanged(); return; } if (poiResult.error == SearchResult.ERRORNO.AMBIGUOUS_KEYWORD) { // 当输入关键字在本市没有找到,但在其他城市找到时,返回包含该关键字信息的城市列表 String strInfo = "在"; for (CityInfo cityInfo : poiResult.getSuggestCityList()) { strInfo += cityInfo.city; strInfo += ","; } strInfo += "找到结果"; Toast.makeText(PoiSearchActivity.this, strInfo, Toast.LENGTH_LONG) .show(); } }
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/sinat_23134455/article/details/48136859