本文整理汇总了Java中com.google.android.gms.maps.OnMapReadyCallback类的典型用法代码示例。如果您正苦于以下问题:Java OnMapReadyCallback类的具体用法?Java OnMapReadyCallback怎么用?Java OnMapReadyCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OnMapReadyCallback类属于com.google.android.gms.maps包,在下文中一共展示了OnMapReadyCallback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onStart
import com.google.android.gms.maps.OnMapReadyCallback; //导入依赖的package包/类
@Override
public void onStart()
{
super.onStart();
if (geoLocation != null)
geoLocation.start(getContext());
this.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap googleMap) {
gMap = googleMap;
initializeMap();
}
});
}
示例2: showPointerOnMap
import com.google.android.gms.maps.OnMapReadyCallback; //导入依赖的package包/类
private void showPointerOnMap(final double latitude, final double longitude) {
mvRestaurantLocation.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap googleMap) {
LatLng latLng = new LatLng(latitude, longitude);
googleMap.addMarker(new MarkerOptions()
.icon(BitmapDescriptorFactory.fromResource(R.drawable.marker_flag))
.anchor(0.0f, 1.0f)
.position(latLng));
googleMap.getUiSettings().setMyLocationButtonEnabled(false);
googleMap.getUiSettings().setZoomControlsEnabled(true);
// Updates the location and zoom of the MapView
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, 15);
googleMap.moveCamera(cameraUpdate);
}
});
}
示例3: init
import com.google.android.gms.maps.OnMapReadyCallback; //导入依赖的package包/类
public void init() {
getMapAsync(new OnMapReadyCallback() {
@Override public void onMapReady(GoogleMap googleMap) {
if (googleMap != null && getActivity() != null) {
NativeGoogleMapFragment.this.googleMap = googleMap;
UiSettings settings = NativeGoogleMapFragment.this.googleMap.getUiSettings();
settings.setZoomControlsEnabled(false);
settings.setMyLocationButtonEnabled(false);
setMyLocationEnabled(myLocationEnabled);
if (onMapLoadedListener != null) {
onMapLoadedListener.onMapLoaded();
}
}
}
});
}
示例4: initViews
import com.google.android.gms.maps.OnMapReadyCallback; //导入依赖的package包/类
private void initViews() {
getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap gMap) {
googleMap = gMap;
googleMap.getUiSettings().setAllGesturesEnabled(true);
googleMap.clear();
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(DEFAULT_LATLNG, DEFAULT_ZOOM));
setCustomInfoWindow();
PlaceMapFragment.this.setMapListeners();
if (place != null) PlaceMapFragment.this.showPlace(place, false, 0, listener);
if (places != null && !places.isEmpty())
PlaceMapFragment.this.showPlaces(places, false, places.get(0).getId(), listener);
}
});
}
示例5: setUpMapIfNeeded
import com.google.android.gms.maps.OnMapReadyCallback; //导入依赖的package包/类
private void setUpMapIfNeeded() {
// Do a null check to confirm that we have not already instantiated the map.
if (mMap == null) {
// Try to obtain the map from the SupportMapFragment.
((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
}
});
// Check if we were successful in obtaining the map.
// if (mMap != null) {
// setUpMap();
// }
}
}
示例6: addFlightPathPoint
import com.google.android.gms.maps.OnMapReadyCallback; //导入依赖的package包/类
@Override
public void addFlightPathPoint(final LatLongAlt coord) {
final LatLng position = MapUtils.coordToLatLng(coord);
getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap googleMap) {
if (showFlightPath) {
if (flightPath == null) {
PolylineOptions flightPathOptions = new PolylineOptions();
flightPathOptions.color(FLIGHT_PATH_DEFAULT_COLOR)
.width(FLIGHT_PATH_DEFAULT_WIDTH).zIndex(1);
flightPath = googleMap.addPolyline(flightPathOptions);
}
List<LatLng> oldFlightPath = flightPath.getPoints();
oldFlightPath.add(position);
flightPath.setPoints(oldFlightPath);
}
}
});
}
示例7: updateDroneLeashPath
import com.google.android.gms.maps.OnMapReadyCallback; //导入依赖的package包/类
@Override
public void updateDroneLeashPath(PathSource pathSource) {
List<LatLong> pathCoords = pathSource.getPathPoints();
final List<LatLng> pathPoints = new ArrayList<LatLng>(pathCoords.size());
for (LatLong coord : pathCoords) {
pathPoints.add(MapUtils.coordToLatLng(coord));
}
if (mDroneLeashPath == null) {
final PolylineOptions flightPath = new PolylineOptions();
flightPath.color(DRONE_LEASH_DEFAULT_COLOR).width(
MapUtils.scaleDpToPixels(DRONE_LEASH_DEFAULT_WIDTH, getResources()));
getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap googleMap) {
mDroneLeashPath = getMap().addPolyline(flightPath);
mDroneLeashPath.setPoints(pathPoints);
}
});
}
else {
mDroneLeashPath.setPoints(pathPoints);
}
}
示例8: updateMissionPath
import com.google.android.gms.maps.OnMapReadyCallback; //导入依赖的package包/类
@Override
public void updateMissionPath(PathSource pathSource) {
List<LatLong> pathCoords = pathSource.getPathPoints();
final List<LatLng> pathPoints = new ArrayList<>(pathCoords.size());
for (LatLong coord : pathCoords) {
pathPoints.add(MapUtils.coordToLatLng(coord));
}
if (missionPath == null) {
final PolylineOptions pathOptions = new PolylineOptions();
pathOptions.color(MISSION_PATH_DEFAULT_COLOR).width(MISSION_PATH_DEFAULT_WIDTH);
getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap googleMap) {
missionPath = getMap().addPolyline(pathOptions);
missionPath.setPoints(pathPoints);
}
});
}
else {
missionPath.setPoints(pathPoints);
}
}
示例9: onCreateView
import com.google.android.gms.maps.OnMapReadyCallback; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.location_fragment, container, false);
mMapView = (MapView) rootView.findViewById(R.id.mapView);
mMapView.onCreate(savedInstanceState);
mMapView.onResume(); // needed to get the map to display immediately
try {
MapsInitializer.initialize(getActivity().getApplicationContext());
} catch (Exception e) {
e.printStackTrace();
}
mMapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap mMap) {
googleMap = mMap;
refreshMap(null);
}
});
return rootView;
}
示例10: onCreateView
import com.google.android.gms.maps.OnMapReadyCallback; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
FrameLayout v = (FrameLayout) inflater.inflate(R.layout.fragment_map, container, false);
mapView = (MapView) v.findViewById(R.id.map);
mapView.onCreate(savedInstanceState);
mapView.onResume();
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap googleMap) {
Log.i("DevMsg", "Success!!!!!");
myMap = googleMap;
populateMap();
}
});
return v;
}
示例11: loadCameraPosition
import com.google.android.gms.maps.OnMapReadyCallback; //导入依赖的package包/类
@Override
public void loadCameraPosition() {
getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap googleMap) {
final SharedPreferences settings = mAppPrefs.prefs;
final CameraPosition.Builder camera = new CameraPosition.Builder();
camera.bearing(settings.getFloat(PREF_BEA, DEFAULT_BEARING));
camera.tilt(settings.getFloat(PREF_TILT, DEFAULT_TILT));
camera.zoom(settings.getFloat(PREF_ZOOM, DEFAULT_ZOOM_LEVEL));
camera.target(new LatLng(settings.getFloat(PREF_LAT, DEFAULT_LATITUDE),
settings.getFloat(PREF_LNG, DEFAULT_LONGITUDE)));
googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(camera.build()));
}
});
}
示例12: onCreate
import com.google.android.gms.maps.OnMapReadyCallback; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map_view);
ActionBar ab = getSupportActionBar();
if (ab != null) {
ab.setDisplayHomeAsUpEnabled(true);
}
mLatlng = getIntent().getStringExtra("latlng");
if (mapMessageLocation == null) {
mapMessageLocation = ((MapFragment) getFragmentManager().findFragmentById(R.id.mapMessageLocation));
}
mapMessageLocation.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap map) {
loadMap(map, mLatlng);
}
});
}
示例13: getMapReadyCallback
import com.google.android.gms.maps.OnMapReadyCallback; //导入依赖的package包/类
private OnMapReadyCallback getMapReadyCallback(final Attraction attraction) {
return new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
mMap.setMyLocationEnabled(true);
mMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() {
@Override
public void onMapClick(LatLng latLng) {
Intent intent = new Intent(mActivity, MapActivity.class);
intent.putExtra(Constants.EXTRA_ATTRACTION, attraction);
mActivity.startActivity(intent);
}
});
updateMapLocation(attraction);
}
};
}
示例14: setUpMap
import com.google.android.gms.maps.OnMapReadyCallback; //导入依赖的package包/类
/**
* Contains the basics for setting up the map.
*/
private void setUpMap() {
if (Utils.checkNetwork(getActivity())) {
if (mMap == null) {
mMapFragment.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap googleMap) {
Log.i(TAG, "onMapReady");
mMap = googleMap;
postSyncMapSetup();
}
});
}
} else {
Utils.connectToast(getActivity());
}
}
示例15: onCreate
import com.google.android.gms.maps.OnMapReadyCallback; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
evercamCamera = VideoActivity.evercamCamera;
setContentView(R.layout.activity_view_camera);
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync((OnMapReadyCallback) this);
setUpDefaultToolbar();
// Initial UI elements
initialScreen();
fillCameraDetails(evercamCamera);
vendorLogoImageView = (ImageView) findViewById(R.id.vendor_logo_image_view);
modelThumbnailImageView = (ImageView) findViewById(R.id.model_thumbnail_image_view);
new RequestVendorListTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}