Java Code Examples for com.google.android.gms.maps.GoogleMap#OnMarkerClickListener
The following examples show how to use
com.google.android.gms.maps.GoogleMap#OnMarkerClickListener .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MapViewPager.java From MapViewPager with Apache License 2.0 | 6 votes |
private GoogleMap.OnMarkerClickListener createMarkerClickListenerSingle(final Adapter adapter) { return new GoogleMap.OnMarkerClickListener() { @Override public boolean onMarkerClick(Marker marker) { for (int i = 0; i < adapter.getCount(); i++) { CameraPosition cp = adapter.getCameraPosition(i); if (cp != null && cp.target != null && cp.target.latitude == marker.getPosition().latitude && cp.target.longitude == marker.getPosition().longitude) { viewPager.setCurrentItem(i); marker.showInfoWindow(); return true; } } return false; } }; }
Example 2
Source File: MapViewPager.java From MapViewPager with Apache License 2.0 | 5 votes |
private GoogleMap.OnMarkerClickListener createMarkerClickListenerMulti(final MultiAdapter adapter) { return new GoogleMap.OnMarkerClickListener() { @Override public boolean onMarkerClick(Marker marker) { for (int page = 0; page < adapter.getCount(); page++) { if (adapter.getCameraPositions(page) != null) { for (int i = 0; i < adapter.getCameraPositions(page).size(); i++) { CameraPosition cp = adapter.getCameraPositions(page).get(i); if (cp != null && cp.target != null && cp.target.latitude == marker.getPosition().latitude && cp.target.longitude == marker.getPosition().longitude) { if (marker.isInfoWindowShown()) { // this doesn't seem to work !! viewPager.setCurrentItem(page); return true; } else { viewPager.setCurrentItem(page); map.animateCamera(CameraUpdateFactory.newCameraPosition(cp)); marker.showInfoWindow(); return true; } } } } } return false; } }; }
Example 3
Source File: MarkerManager.java From android-maps-utils with Apache License 2.0 | 4 votes |
public void setOnMarkerClickListener(GoogleMap.OnMarkerClickListener markerClickListener) { mMarkerClickListener = markerClickListener; }