最近在做百度地图的搜索功能,但是遇到如下两个问题:
1. setContentView(R.layout.activity_main)之前初始化,否则会报错
bMapManager = new BMapManager(getApplication());
bMapManager.init("285B415EBAB2A92293E85502150ADA7F03C777C4", null);

setContentView(R.layout.activity_main);

// 初始化mapview对象,并且设置显示缩放控件
mapView = (MapView) findViewById(R.id.bmapsView);
mapView.setBuiltInZoomControls(true);

// 初始化关键词输入框和按钮控件
editText = (EditText) findViewById(R.id.editText1);
button = (Button) findViewById(R.id.button1);

// 定义地图控件,获取mapview的控制,并把地图范围定位北京市
MapController mapController = mapView.getController();
GeoPoint point =new GeoPoint((int)(28.187* 1E6),(int)(112.990* 1E6));
mapController.setCenter(point);
mapController.setZoom(12);

// 初始化Poi搜索对象
mkSearch = new MKSearch();
mkSearch.init(bMapManager, mkSearchListener);

button.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
String key = editText.getText().toString();
// 如果关键字为空则不进入搜索
if(key.equals(""))
{
Toast.makeText(MainActivity.this, "请输入搜索关键词!", Toast.LENGTH_SHORT).show();
}
else 
{
mkSearch.poiSearchInCity("长沙", key);
}
}
});
当我在mkSearch.poiSearchInCity("长沙", key);已经定位搜索的城市,当我输入其他城市的搜索地点时搜索不到,我的问题是我想不精准到某个城市,而是在输入了一个搜索关键字全国范围内的地点都会匹配出来
第二个问题:就是搜索结果(搜索结果如下),在结果中显示了公交路线我要去掉公交路线,该怎么做
07-25 16:40:57.180: I/System.out(20052): address:湖南省长沙市五一大道202号 city:长沙市 lat:28201590 long:112981590 arg:11 arg2:0
07-25 16:40:57.180: I/System.out(20052): address:117路;117路;118路;118路;旅1路;旅1路 city:长沙市 lat:28200930 long:112981500 arg:11 arg2:0
07-25 16:40:57.180: I/System.out(20052): address:芙蓉区南阳街 city:长沙市 lat:28201964 long:112983890 arg:11 arg2:0
07-25 16:40:57.180: I/System.out(20052): address:长沙市芙蓉区蔡锷中路159号 city:长沙市 lat:28201917 long:112987510 arg:11 arg2:0
07-25 16:40:57.180: I/System.out(20052): address:中山路222号(三角花园对面中山亭旁) city:长沙市 lat:28203357 long:112984141 arg:11 arg2:0
07-25 16:40:57.180: I/System.out(20052): address:芙蓉区五一大道868号皇冠假日酒店2-3楼(近五一广场) city:长沙市 lat:28201543 long:112982596 arg:11 arg2:0
07-25 16:40:57.180: I/System.out(20052): address:黄兴中路80号 city:长沙市 lat:28199227 long:112983234 arg:11 arg2:0
07-25 16:40:57.180: I/System.out(20052): address:长沙市开福区 city:长沙市 lat:28203039 long:112982102 arg:11 arg2:0
07-25 16:40:57.180: I/System.out(20052): address:长沙市中山西路398号 city:长沙市 lat:28206517 long:112979785 arg:11 arg2:0
07-25 16:40:57.180: I/System.out(20052): address:长沙市芙蓉区五一西路78号(蝴蝶大厦) city:长沙市 lat:28201439 long:112987483 arg:11 arg2:0