本文整理汇总了Java中com.google.android.gms.maps.GoogleMap.setOnInfoWindowClickListener方法的典型用法代码示例。如果您正苦于以下问题:Java GoogleMap.setOnInfoWindowClickListener方法的具体用法?Java GoogleMap.setOnInfoWindowClickListener怎么用?Java GoogleMap.setOnInfoWindowClickListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.maps.GoogleMap
的用法示例。
在下文中一共展示了GoogleMap.setOnInfoWindowClickListener方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onMapReady
import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
public void onMapReady(final GoogleMap googleMap) {
for(int i=0;i<PicList.size();i++)
{
LatLng place = new LatLng(Double.valueOf(PicList.get(i).get_latitude()),Double.valueOf(PicList.get(i).get_longitude()));
//make small size icon
Bitmap smallMarker = Bitmap.createScaledBitmap(imgeHelper.getBitmapFromByteArray(PicList.get(i).get_thumbnail()), 70, 70, false);
googleMap.addMarker(new MarkerOptions().position(place)
.title(PicList.get(i).get_city())).setIcon(BitmapDescriptorFactory.fromBitmap(smallMarker));
googleMap.moveCamera(CameraUpdateFactory.newLatLng(place));
// Set a listener for marker click.
googleMap.setOnMarkerClickListener(this);
//this listener is listening the events that you click on the title of the map marker
googleMap.setOnInfoWindowClickListener(new GoogleMap.OnInfoWindowClickListener() {
@Override
public void onInfoWindowClick(Marker marker) {
DBHelper dbHelper = new DBHelper(getContext(), "Picture.db", null, 1);
picCities = dbHelper.selectPicFromCity(marker.getTitle());
//send data to citygallery activity
Intent intent = new Intent(getContext(), CItyGalleryActivity.class);
intent.putExtra("cityChoise",picCities.get(0).get_city().toString());
startActivity(intent);
dbHelper.close();
}
});
}
}
示例2: onMapReady
import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
// Add a marker in Sydney, Australia,
// and move the map's camera to the same location.
LatLng sydney = new LatLng(-33.852, 151.211);
MarkerOptions marker = new MarkerOptions().position(sydney)
.title("Marker in Sydney");
googleMap.addMarker(marker);
googleMap.setOnInfoWindowClickListener(this);
googleMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}
示例3: MapsManager
import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
MapsManager(Activity context, GoogleMap map) {
mContext = context;
// 地圖
mMaps.add(MAP_CODE_MAIN, map);
mMapTiles.add(MAP_CODE_MAIN, null);
mZoomNumber = (TextView) context.findViewById(R.id.zoom_number);
// 顯示準心座標
mCrossCoor = (TextView) context.findViewById(R.id.tvCoord);
mCrossCoor.setOnClickListener((MapsActivity) mContext);
// 加入比例尺
RelativeLayout container = (RelativeLayout) context.findViewById(R.id.layout_container);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(800, 800);
mScaleBar = new ScaleBar(mContext, getMap(MAP_CODE_MAIN));
mScaleBar.setLayoutParams(params);
container.addView(mScaleBar);
// 註冊畫面縮放的監聽
map.setOnCameraMoveListener(this);
// Set the Listener
map.setOnMapClickListener(this);
map.setOnMapLongClickListener(this);
map.setOnInfoWindowClickListener(this);
map.setOnMarkerDragListener(this);
map.setOnCameraIdleListener(this);
// 在Activity和Map物件註冊ClusterManager
mClusterManagers.add(MAP_CODE_MAIN, new ClusterManager<CustomMarker>(mContext, map));
// The Rule about Cluster Managing
mClusterManagers.get(MAP_CODE_MAIN).setRenderer(
new CustomRenderer(mContext, map, mClusterManagers.get(MAP_CODE_MAIN)));
mClusterManagers.get(MAP_CODE_MAIN).setOnClusterClickListener(
(CustomRenderer) mClusterManagers.get(MAP_CODE_MAIN).getRenderer());
// Click on marker to open infoWindow
map.setOnMarkerClickListener(mClusterManagers.get(MAP_CODE_MAIN));
// POI in Google map
map.setOnPoiClickListener(this);
// Test for new info window
map.setInfoWindowAdapter(new CustomAdapter(mContext));
}