Java 类com.baidu.mapapi.map.BaiduMap.OnMarkerClickListener 实例源码

项目:camera    文件:MainActivity.java   
private void initMarkerClickEvent() {

          mBaiduMap.setOnMarkerClickListener(new OnMarkerClickListener()
          {
                  @Override
                  public boolean onMarkerClick(final Marker marker)
                  {

               LatLng markerLat = marker.getPosition();
               Point p = mBaiduMap.getProjection().toScreenLocation(markerLat);
                //mMarkerInfoLy.setVisibility(View.VISIBLE);
               View location = getPopCameraView();
               p.y = -83;
               mInfoWindow = new InfoWindow(location, markerLat,p.y);
 mBaiduMap.showInfoWindow(mInfoWindow);
// Log.d("wang","setOnMarkerClickListener location.latitude is " + markerLat.latitude + " location.longitude is " + markerLat.longitude);
               judgeClickCamera(markerLat);
                flag = true;
               return true;
                  }
          });
  }
项目:eDao    文件:MapActivity.java   
private void initMarkerClickEvent() {
    // 对Marker的点击
    mBaiduMap.setOnMarkerClickListener(new OnMarkerClickListener() {
        @Override
        public boolean onMarkerClick(final Marker marker) {
            // 将marker所在的经纬度的信息转化成屏幕上的坐标
            System.out.println("点击marker:" + marker.getPosition() + marker.toString());
            final LatLng ll = marker.getPosition();
            int index = marker.getZIndex();
            if (index == 2) {
                float tempZoom = 18;
                if (curZoom != 17)
                    tempZoom = curZoom + 1.0f;
                showCurrtenStroeOnMap(ll, tempZoom);
            } else {
                // 获得marker中的数据
                StoreData info = (StoreData) marker.getExtraInfo().get("info");

                Bundle pBundle = new Bundle();
                pBundle.putSerializable("data", info);
                openActivity(StoreInformationActivity.class, pBundle);
            }
            return true;
        }
    });
}
项目:Traffic-Boy    文件:NearActivity.java   
@SuppressWarnings("unchecked")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_near);

    allInc = (List<Incident>) getIntent().getBundleExtra("bundle")
            .getSerializable("allInc");

    troubleMaker = new ArrayList<Marker>();
    crowdMaker = new ArrayList<Marker>();
    clearMaker = new ArrayList<Marker>();
    controlMaker = new ArrayList<Marker>();

    initCheckBoxes();

    locationMode = LocationMode.FOLLOWING;
    bitmapDescriptor = null;

    mapView = (MapView) findViewById(R.id.map_near);
    baiduMap = mapView.getMap();

    baiduMap.setMyLocationConfigeration(new MyLocationConfiguration(
            locationMode, true, bitmapDescriptor));

    baiduMap.setMyLocationEnabled(true);
    baiduMap.setOnMarkerClickListener(new OnMarkerClickListener() {

        @Override
        public boolean onMarkerClick(Marker arg0) {

            String type = arg0.getTitle();
            String addr = arg0.getExtraInfo().getString("addr");

            Button bubble = new Button(getApplicationContext());
            bubble.setBackgroundResource(R.drawable.popup);
            bubble.setText("类型:" + type + "\n" + "地点:" + addr);
            InfoWindow window = new InfoWindow(bubble, arg0.getPosition(),
                    -70);
            baiduMap.showInfoWindow(window);
            return true;
        }
    });

    locationClient = new LocationClient(this);
    locationClient.registerLocationListener(new BDLocationListener() {

        @Override
        public void onReceiveLocation(BDLocation location) {
            // TODO Auto-generated method stub
            if (location == null || mapView == null)
                return;
            MyLocationData locationData = new MyLocationData.Builder()
                    .accuracy(location.getRadius()).direction(100)
                    .latitude(location.getLatitude())
                    .longitude(location.getLongitude()).build();
            baiduMap.setMyLocationData(locationData);

            if (isFirstLoc) {
                isFirstLoc = false;
                LatLng ll = new LatLng(location.getLatitude(), location
                        .getLongitude());
                MapStatusUpdate update = MapStatusUpdateFactory
                        .newLatLng(ll);
                baiduMap.animateMapStatus(update);
            }
        }

    });

    LocationClientOption clientOption = new LocationClientOption();
    clientOption.setOpenGps(true);
    clientOption.setCoorType("bd09ll");
    clientOption.setScanSpan(1000);
    locationClient.setLocOption(clientOption);
    locationClient.start();

    addSignals();
}