本文整理匯總了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);
}