当前位置: 首页>>代码示例>>Java>>正文


Java OnMyLocationChangeListener类代码示例

本文整理汇总了Java中com.google.android.gms.maps.GoogleMap.OnMyLocationChangeListener的典型用法代码示例。如果您正苦于以下问题:Java OnMyLocationChangeListener类的具体用法?Java OnMyLocationChangeListener怎么用?Java OnMyLocationChangeListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OnMyLocationChangeListener类属于com.google.android.gms.maps.GoogleMap包,在下文中一共展示了OnMyLocationChangeListener类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setOnMyLocationChangeListener

import com.google.android.gms.maps.GoogleMap.OnMyLocationChangeListener; //导入依赖的package包/类
@Override
public final void setOnMyLocationChangeListener(OnMyLocationChangeListener listener) {
    map.setOnMyLocationChangeListener(listener);
}
 
开发者ID:mosquitolabs,项目名称:referendum_1o_android,代码行数:5,代码来源:GoogleMapWrapper.java

示例2: setOnMyLocationChangedListener

import com.google.android.gms.maps.GoogleMap.OnMyLocationChangeListener; //导入依赖的package包/类
private void setOnMyLocationChangedListener() {
	mGoogleMap.setOnMyLocationChangeListener(new OnMyLocationChangeListener() {
		@Override
		public void onMyLocationChange(Location loc) {
			float zoomLevel = mCurrentZoom;
			mCurrentLocation = loc;

			mGoogleMap.clear();
			
			if(mDestinationLocation == null) {
				mDestinationLocation = new Location(loc);	// Destination is not selected yet. Initialize destination
				mNaviInfo.initDestLocation(mDestinationLocation);
				// If there is pre-used destination, show it on map 
				if(mNaviInfo.getDestLatitude() != 0 && mNaviInfo.getDestLongitude() != 0) {
					drawDestination(new LatLng(mNaviInfo.getDestLatitude(), mNaviInfo.getDestLongitude()), false);
				}
			} else {
				mNaviInfo.setCurLocation(loc);
			}
			
			if(!mIsInitialized) {
				zoomLevel = INITIAL_ZOOM_LEVEL;
			} else {
				zoomLevel = 0;
			}
			

			addMarkerOnMap(loc.getLatitude(), loc.getLongitude(), 
					"I'm here", 		// title
					loc.getLatitude() + ", " + loc.getLongitude(), 			// snippet
					false,				// draggable
					MARKER_DEFAULT, 	// marker
					zoomLevel, 			// 0 means keep current zoom level
					!mIsInitialized);				// move camera only when it's first time
			
			if(mNaviInfo.getDestLatitude() == 0 && mNaviInfo.getDestLongitude() == 0) {
				// Destination is not set. Do nothing
			} else {
				drawDestination(new LatLng(mNaviInfo.getDestLatitude(), mNaviInfo.getDestLongitude()), false);
			}
			
			mIsInitialized = true;
			
			mUnitType = AppSettings.getUnitType();
			StringBuilder sb = new StringBuilder();
			sb.append(mNaviMode==NAVI_MODE_COMPASS?"compass":"direction");
			sb.append(",");
			sb.append(mUnitType==UNIT_TYPE_METERS?"meters":"feet");
			mFragmentListener.OnFragmentCallback(IFragmentListener.CALLBACK_MAP_UPDATE_NAVI_INFO,
					(int)mNaviInfo.getDistance(), (int)mNaviInfo.getAngle(),
					String.format("%.3f", mDestinationLocation.getLatitude()), 
					String.format("%.3f", mDestinationLocation.getLongitude()), 
					sb.toString());
		}
	});
}
 
开发者ID:godstale,项目名称:Arduino-Navigator,代码行数:57,代码来源:GMapControl.java

示例3: setOnMyLocationChangeListener

import com.google.android.gms.maps.GoogleMap.OnMyLocationChangeListener; //导入依赖的package包/类
void setOnMyLocationChangeListener(OnMyLocationChangeListener listener); 
开发者ID:mosquitolabs,项目名称:referendum_1o_android,代码行数:2,代码来源:IGoogleMap.java


注:本文中的com.google.android.gms.maps.GoogleMap.OnMyLocationChangeListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。