本文整理汇总了Java中com.google.android.gms.maps.MapsInitializer类的典型用法代码示例。如果您正苦于以下问题:Java MapsInitializer类的具体用法?Java MapsInitializer怎么用?Java MapsInitializer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MapsInitializer类属于com.google.android.gms.maps包,在下文中一共展示了MapsInitializer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onMapReady
import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
MapsInitializer.initialize(getActivity());
final ViewOption viewOption = getViewOption();
calculateAreaAndLength(viewOption);
MapUtils.showElements(viewOption, googleMap, getActivity());
googleMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() {
@Override
public void onMapClick(LatLng latLng) {
Bundle args = new Bundle();
args.putParcelable("optionView", viewOption);
Intent intent = new Intent(getActivity(), MapsActivity.class);
intent.putExtra("args", args);
startActivity(intent);
}
});
}
示例2: initMap
import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
protected void initMap(GoogleMap map) {
goToLocation = true;
firstLocationRefresh = true;
if (map != null) {
MapsInitializer.initialize(getActivity());
RAApplication.getInstance().getGpsDetector().setGpsMapListener(new GPSDetector.GpsMapListener() {
@Override
public void onGpsMapListener(final Location location) {
ActivityUtil.runOnMainThread(new Runnable() {
@Override
public void run() {
if (refreshMyLocation) {
setCurrentLocation(location);
}
}
});
}
});
clearMap();
LatLng loc = new LatLng(Constants.LATITUDE_BELARUS, Constants.LONGITUDE_BELARUS);
map.moveCamera(CameraUpdateFactory.newLatLngZoom(loc, Constants.DEFAULT_CAMERA_ZOOM));
refreshMyLocation(loc);
initMapData();
}
}
示例3: onCreateView
import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_bootprint_map, container, false);
ButterKnife.bind(this, view);
MapsInitializer.initialize(getActivity());
mMapView.onCreate(savedInstanceState);
// init bootprints
//TOmaybeDO better data structure for this
mBootprintLocations = new ArrayList<>(MAX_BOOTPRINTS);
mLeftBootprint = BitmapDescriptorFactory.fromResource(R.drawable.bootprint_left);
mRightBootprint = BitmapDescriptorFactory.fromResource(R.drawable.bootprint_right);
// init map
mHasSetInitialCameraPosition = false;
mMapView.getMapAsync(this);
return view;
}
示例4: onCreateView
import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.map_fragment, container, false);
mMapView = ((MapView) rootView.findViewById(R.id.map));
mMapView.onCreate(savedInstanceState);
mMapView.getMapAsync(this);
MapsInitializer.initialize(getActivity());
RealTimePositionVelocityCalculator currentPositionVelocityCalculator =
mPositionVelocityCalculator;
if (currentPositionVelocityCalculator != null) {
currentPositionVelocityCalculator.setMapFragment(this);
}
return rootView;
}
示例5: onCreate
import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
instance = this;
if (!FirebaseApp.getApps(this).isEmpty()) {
analytics = FirebaseAnalytics.getInstance(this);
}
MapsInitializer.initialize(this);
Deelgebied.initialize(this.getResources());
AppData.initialize(this.getFilesDir());
File dir = this.getFilesDir();
String file = dir.getAbsolutePath();
dir.exists();
}
示例6: onCreateView
import com.google.android.gms.maps.MapsInitializer; //导入依赖的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;
}
示例7: onCreateView
import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_map, container, false);
mapView = (MapView) v.findViewById(R.id.map);
mapView.onCreate(savedInstanceState);
mapView.onResume();// needed to get the googleMap to display immediately
try {
MapsInitializer.initialize(getActivity().getApplicationContext());
} catch (Exception e) {
e.printStackTrace();
}
mapView.getMapAsync(this);
progressBar = (ProgressBar) v.findViewById(R.id.progressBar);
emptyListTextView = (TextView) v.findViewById(R.id.emptyListText);
mapUpdateHandler = new Handler();
mapUpdater.run();
return v;
}
示例8: onCreateView
import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.location_fragment, container, false);
// Gets the MapView from the XML layout and creates it
mapView = (MapView) view.findViewById(R.id.map);
mapView.onCreate(savedInstanceState);
// Gets to GoogleMap from the MapView and does initialization stuff
map = mapView.getMap();
map.getUiSettings().setMyLocationButtonEnabled(false);
map.setMyLocationEnabled(true);
// Needs to call MapsInitializer before doing any CameraUpdateFactory calls
MapsInitializer.initialize(this.getActivity());
map.setOnMarkerDragListener(this);
mNetworkConnection = new NetworkConnection(getActivity());
mLocationProvider = new LocationProvider(getActivity(), this);
return view;
}
示例9: initializeMap
import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
private void initializeMap() throws GooglePlayServicesNotAvailableException {
try {
MapsInitializer.initialize(getActivity());
if (getActivity().getSupportFragmentManager().findFragmentById(
R.id.mapContainer) == null) {
mapSupportFragment = MySupportMapFragment
.newInstatnce(new Bundle());
mapSupportFragment.setTargetFragment(this, 100);
if (getArguments() != null)
mapSupportFragment.setArguments(getArguments());
getActivity().getSupportFragmentManager().beginTransaction()
.add(R.id.mapContainer, mapSupportFragment).commit();
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例10: onMapReady
import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
mGoogleMap = googleMap;
if (mGoogleMap != null) {
// Needs to call MapsInitializer before doing any CameraUpdateFactory calls
try {
initializeGoogleMap();
MapsInitializer.initialize(mContext);
} catch (Exception e) {
e.printStackTrace();
}
mGoogleMap.setOnMyLocationChangeListener(myLocationChangeListener);
} else {
Log.i(TAG, "MapView is NULL");
}
}
示例11: onMapReady
import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
mGoogleMap = googleMap;
MapsInitializer.initialize(getContext());
googleMap.getUiSettings().setMapToolbarEnabled(true);
if (mMapLocation != null && !mOptionView.isMultipleMarker() && mOptionView.isSingleMarker()) {
updateMapContents();
}
if(mOptionView.getLatLngArray() != null && mOptionView.getLatLngArray().length > 0 && mOptionView.isMultipleMarker() && !mOptionView.isSingleMarker())
{
updateMapContents();
}
if(mOptionView.getLatLngList() != null && mOptionView.getLatLngList().size() > 0 && mOptionView.isMultipleMarker() && !mOptionView.isSingleMarker())
{
updateMapContents();
}
}
示例12: onMapReady
import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
MapsInitializer.initialize(getActivity()); // required for the CameraUpdateFactory to be initialized
googleMap.clear();
googleMap.setMyLocationEnabled(true);
googleMap.addMarker(new MarkerOptions().position(fromLocation).title(fromTitle));
googleMap.addMarker(new MarkerOptions().position(toLocation).title(toTitle));
List<LatLng> route = PolyUtil.decode(encodedRoute);
googleMap.addPolyline(new PolylineOptions().addAll(route).color(R.color.green));
LatLngBounds bounds = new LatLngBounds.Builder()
.include(fromLocation)
.include(toLocation)
.build();
googleMap.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 100));
}
示例13: setMap
import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
private void setMap() {
MapsInitializer.initialize(getActivity().getApplicationContext());
GoogleMap googleMap = mMapView.getMap();
LatLng latLng = new LatLng(49.426863, 32.095314);
MarkerOptions marker = new MarkerOptions().position(latLng);
marker.icon(BitmapDescriptorFactory
.defaultMarker(BitmapDescriptorFactory.HUE_ROSE));
googleMap.addMarker(marker);
CameraPosition cameraPosition = new CameraPosition.Builder()
.target(latLng).zoom(12).build();
googleMap.animateCamera(CameraUpdateFactory
.newCameraPosition(cameraPosition));
}
示例14: onCreateView
import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_map, container, false);
if (rootView == null) {
Log.e(TAG, "rootView is null in onCreateView in QPMapFragment");
return null;
}
MapsInitializer.initialize(getMyActivity());
mMapView = (MapView) rootView.findViewById(R.id.map);
if (mMapView != null) {
mMapView.onCreate(mBundle);
setUpMapIfNeeded(rootView);
}
MainActivity mainActivity = (MainActivity) getActivity();
CheckBox followingUserCB = (CheckBox) rootView.findViewById(R.id.follow_user_checkBox);
followingUserCB.setChecked(mainActivity.isFollowingUser());
return rootView;
}
示例15: onMapReady
import com.google.android.gms.maps.MapsInitializer; //导入依赖的package包/类
@Override
public void onMapReady(GoogleMap map) {
this.map = map;
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED ||
ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
map.getUiSettings().setMyLocationButtonEnabled(true);
map.setMyLocationEnabled(true);
map.setOnMyLocationButtonClickListener(this);
}
MapsInitializer.initialize(this);
if (inViewMode) {
drawMarker();
}
setupMapListeners();
}