當前位置: 首頁>>代碼示例>>Java>>正文


Java OnMarkerClickListener類代碼示例

本文整理匯總了Java中com.google.android.gms.maps.GoogleMap.OnMarkerClickListener的典型用法代碼示例。如果您正苦於以下問題:Java OnMarkerClickListener類的具體用法?Java OnMarkerClickListener怎麽用?Java OnMarkerClickListener使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


OnMarkerClickListener類屬於com.google.android.gms.maps.GoogleMap包,在下文中一共展示了OnMarkerClickListener類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: whenMarkerClick

import com.google.android.gms.maps.GoogleMap.OnMarkerClickListener; //導入依賴的package包/類
/**
 * when marker is clicked
 *
 * @param callback
 */
public void whenMarkerClick(final MarkerCallback callback) {
    map.setOnMarkerClickListener(new OnMarkerClickListener() {
        @Override
        public boolean onMarkerClick(Marker marker) {
            callback.invokedMarker(map, marker);

            return true;
        }
    });
}
 
開發者ID:kewang,項目名稱:map-controller,代碼行數:16,代碼來源:MapController.java

示例2: onResume

import com.google.android.gms.maps.GoogleMap.OnMarkerClickListener; //導入依賴的package包/類
@Override
public void onResume() {
    if(getMap() != null && getView() != null) {
        // Ponemos que inicie el mapa en el Kiosko de Surbus
        getMap().moveCamera(CameraUpdateFactory.newLatLng(coordenadas));
        getMap().setMapType(GoogleMap.MAP_TYPE_HYBRID);
        getMap().setMyLocationEnabled(true);
        getMap().setOnMyLocationChangeListener(this);
        getMap().moveCamera(CameraUpdateFactory.zoomTo(15));
        getMap().setOnMarkerClickListener(new OnMarkerClickListener() {
            
            @Override
            public boolean onMarkerClick(Marker marker) {
                synchronized (DataStorage.paradas) {
                    Parada p = DataStorage.paradas.get(Integer.parseInt(marker.getTitle()));
                    DialogFragment f = MostrarInfoParada.newInstance(p.getId());
                    f.show(getActivity().getSupportFragmentManager(), "Info");
                }
                return true;
            }
        });
        bitmapParada = BitmapDescriptorFactory.fromResource(R.drawable.bus_stop);
        buscarParadas();
    }
    super.onResume();
}
 
開發者ID:Arasthel,項目名稱:AlmeriBus,代碼行數:27,代碼來源:CustomMapFragment.java

示例3: getAnimatedMarkerClickListener

import com.google.android.gms.maps.GoogleMap.OnMarkerClickListener; //導入依賴的package包/類
/**
 * Get a MarkerClickListener that calls our custom selectMarker method
 *
 * @return OnMarkerClickListener that calls selectMarker
 */
public OnMarkerClickListener getAnimatedMarkerClickListener()
{
    return new OnMarkerClickListener()
    {
        @Override
        public boolean onMarkerClick(Marker marker)
        {
            selectMarker(marker);
            return false;
        }
    };
}
 
開發者ID:jt-gilkeson,項目名稱:google-maps-utils,代碼行數:18,代碼來源:MarkerSelectionAnimator.java

示例4: setOnMarkerClickListener

import com.google.android.gms.maps.GoogleMap.OnMarkerClickListener; //導入依賴的package包/類
@Override
public final void setOnMarkerClickListener(OnMarkerClickListener listener) {
    map.setOnMarkerClickListener(listener);
}
 
開發者ID:mosquitolabs,項目名稱:referendum_1o_android,代碼行數:5,代碼來源:GoogleMapWrapper.java

示例5: onActivityCreated

import com.google.android.gms.maps.GoogleMap.OnMarkerClickListener; //導入依賴的package包/類
@Override
public void onActivityCreated(Bundle savedInstanceState) {
  super.onActivityCreated(savedInstanceState);
  if (savedInstanceState != null) {
    keepCurrentLocationVisible = savedInstanceState.getBoolean(
        KEEP_CURRENT_LOCATION_VISIBLE_KEY, false);
    if (keepCurrentLocationVisible) {
      Location location = (Location) savedInstanceState.getParcelable(CURRENT_LOCATION_KEY);
      if (location != null) {
        setCurrentLocation(location);
      }
    }
  }

  /*
   * At this point, after onCreateView, getMap will not return null and we can
   * initialize googleMap. However, onActivityCreated can be called multiple
   * times, e.g., when the user switches tabs. With
   * GoogleMapOptions.useViewLifecycleInFragment == false, googleMap lifecycle
   * is tied to the fragment lifecycle and the same googleMap object is
   * returned in getMap. Thus we only need to initialize googleMap once, when
   * it is null.
   */
  if (googleMap == null) {
    googleMap = getMap();
    googleMap.setMyLocationEnabled(true);

    /*
     * My Tracks needs to handle the onClick event when the my location button
     * is clicked. Currently, the API doesn't allow handling onClick event,
     * thus hiding the default my location button and providing our own.
     */
    googleMap.getUiSettings().setMyLocationButtonEnabled(false);
    googleMap.setIndoorEnabled(true);
    googleMap.setOnMarkerClickListener(new OnMarkerClickListener() {

        @Override
      public boolean onMarkerClick(Marker marker) {
        if (isResumed()) {
          String title = marker.getTitle();
          if (title != null && title.length() > 0) {
            long id = Long.valueOf(title);
            Context context = getActivity();
            Intent intent = IntentUtils.newIntent(context, MarkerDetailActivity.class)
                .putExtra(MarkerDetailActivity.EXTRA_MARKER_ID, id);
            context.startActivity(intent);
          }
        }
        return true;
      }
    });
    googleMap.setLocationSource(new LocationSource() {

        @Override
      public void activate(OnLocationChangedListener listener) {
        onLocationChangedListener = listener;
      }

        @Override
      public void deactivate() {
        onLocationChangedListener = null;
      }
    });
    googleMap.setOnCameraChangeListener(new OnCameraChangeListener() {

        @Override
      public void onCameraChange(CameraPosition cameraPosition) {
        if (isResumed() && keepCurrentLocationVisible && currentLocation != null
            && !isLocationVisible(currentLocation)) {
          keepCurrentLocationVisible = false;
        }
      }
    });
  }
}
 
開發者ID:Plonk42,項目名稱:mytracks,代碼行數:76,代碼來源:MyTracksMapFragment.java

示例6: setOnMarkerClickListener

import com.google.android.gms.maps.GoogleMap.OnMarkerClickListener; //導入依賴的package包/類
@Override
public final void setOnMarkerClickListener(OnMarkerClickListener listener) {
    map.setOnMarkerClickListener(listener);
}
 
開發者ID:mtransitapps,項目名稱:mtransit-for-android,代碼行數:5,代碼來源:GoogleMapWrapper.java

示例7: setOnMarkerClickListener

import com.google.android.gms.maps.GoogleMap.OnMarkerClickListener; //導入依賴的package包/類
void setOnMarkerClickListener(OnMarkerClickListener listener); 
開發者ID:mosquitolabs,項目名稱:referendum_1o_android,代碼行數:2,代碼來源:IGoogleMap.java


注:本文中的com.google.android.gms.maps.GoogleMap.OnMarkerClickListener類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。