2015-12-02 38 views
1

我使用百度地圖開發的的Andriod app.I我的地圖數據上傳到百度,然後使用本地搜索得到的數據:點擊百度地圖標記並獲得信息來源相關標記

CloudManager.getInstance().init(this); 
NearbySearchInfo info = new NearbySearchInfo(); 
info.ak = "xxxxxxxxxxx"; 
info.geoTableId = xxxxxx; 
info.radius = 30000; 
info.location = App.getLocation().getLongitude()+","+App.getLocation().getLatitude(); 
CloudManager.getInstance().nearbySearch(info); 

,然後回調在地圖上顯示的數據:

@Override 
public void onGetSearchResult(CloudSearchResult cloudSearchResult, int i) { 
    if (cloudSearchResult != null && cloudSearchResult.poiList != null 
      && cloudSearchResult.poiList.size() > 0){ 
     BitmapDescriptor bd = BitmapDescriptorFactory.fromResource(R.drawable.icon_gcoding); 
     LatLng ll; 
     LatLngBounds.Builder builder = new LatLngBounds.Builder(); 

     for (CloudPoiInfo info : cloudSearchResult.poiList) { 
      ll = new LatLng(info.latitude, info.longitude); 
      OverlayOptions oo = new MarkerOptions().icon(bd).position(ll); 
      map.addOverlay(oo); 
      builder.include(ll); 

     } 
     LatLngBounds bounds = builder.build(); 
     MapStatusUpdate u = MapStatusUpdateFactory.newLatLngBounds(bounds); 
     map.animateMapStatus(u); 
    } 
} 

顯示在地圖上標記後,我想點擊一個標記,並獲得相關的標記數據。

可用嗎?我找不到任何答案,有沒有解決方案可行?提前致謝!

回答

0

試試這個,

new MarkerOptions().icon(bd).position(ll).snippet("Information of place"); 
     map.addOverlay(oo); 
+0

這不是我想要的東西,這就像[這](http://pan.baidu.com/s/1bodCiZX)。它只是附近的搜索功能而不是POI搜索​​。 POI搜索​​無法使用我的地圖信息。 – Uphie

+0

@uphie:你得到了你的問題的答案嗎?你可以請你的答案代碼片段作爲你的答案。 – Zax

相關問題