本文整理汇总了Java中com.mapbox.mapboxsdk.maps.MapView.onCreate方法的典型用法代码示例。如果您正苦于以下问题:Java MapView.onCreate方法的具体用法?Java MapView.onCreate怎么用?Java MapView.onCreate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mapbox.mapboxsdk.maps.MapView
的用法示例。
在下文中一共展示了MapView.onCreate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.mapbox.mapboxsdk.maps.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Mapbox access token is configured here. This needs to be called either in your application
// object or in the same activity which contains the mapview.
Mapbox.getInstance(this, getString(R.string.access_token));
// Configure initial map state
MapboxMapOptions options = new MapboxMapOptions()
.attributionTintColor(RED_COLOR)
.compassFadesWhenFacingNorth(false)
.styleUrl(Style.MAPBOX_STREETS)
.camera(new CameraPosition.Builder()
.target(new LatLng(25.255377, 55.3089185))
.zoom(11.86)
.tilt(10)
.build());
mapView = new MapView(this, options);
mapView.setId(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(this);
setContentView(mapView);
}
示例2: onCreate
import com.mapbox.mapboxsdk.maps.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Mapbox access token is configured here. This needs to be called either in your application
// object or in the same activity which contains the mapview.
Mapbox.getInstance(this, getString(R.string.access_token));
// This contains the MapView in XML and needs to be called after the access token is configured.
setContentView(R.layout.activity_mas_map_matching);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
map = mapboxMap;
new DrawGeoJson().execute();
}
});
}
示例3: onCreate
import com.mapbox.mapboxsdk.maps.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Mapbox access token is configured here. This needs to be called either in your application
// object or in the same activity which contains the mapview.
Mapbox.getInstance(this, getString(R.string.access_token));
// This contains the MapView in XML and needs to be called after the access token is configured.
setContentView(R.layout.activity_annotation_polygon);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
drawPolygon(mapboxMap);
}
});
}
示例4: onCreate
import com.mapbox.mapboxsdk.maps.MapView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Mapbox access token is configured here. This needs to be called either in your application
// object or in the same activity which contains the mapview.
Mapbox.getInstance(this, getString(R.string.access_token));
// This contains the MapView in XML and needs to be called after the access token is configured.
setContentView(R.layout.activity_style_default);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
DefaultStyleActivity.this.mapboxMap = mapboxMap;
// customize map with markers, polylines, etc
}
});
}
示例5: onCreate
import com.mapbox.mapboxsdk.maps.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Mapbox access token is configured here. This needs to be called either in your application
// object or in the same activity which contains the mapview.
Mapbox.getInstance(this, getString(R.string.access_token));
// This contains the MapView in XML and needs to be called after the access token is configured.
setContentView(R.layout.activity_marker_clusters_plugin);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
MarkerClustersPluginActivity.this.mapboxMap = mapboxMap;
mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(48.865539, 2.348603), 10.8),2800);
// Initializing the cluster plugin
clusterManagerPlugin = new ClusterManagerPlugin<>(MarkerClustersPluginActivity.this, mapboxMap);
initCameraListener();
}
});
}
示例6: onCreate
import com.mapbox.mapboxsdk.maps.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Mapbox access token is configured here. This needs to be called either in your application
// object or in the same activity which contains the mapview.
Mapbox.getInstance(this, getString(R.string.access_token));
// This contains the MapView in XML and needs to be called after the access token is configured.
setContentView(R.layout.activity_geojson_plugin);
setUpFabButtons();
progressBar = (ProgressBar) findViewById(R.id.geoJSONLoadProgressBar);
coordinatorLayout = (CoordinatorLayout) findViewById(R.id.coordinatorLayout);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(this);
}
示例7: onCreate
import com.mapbox.mapboxsdk.maps.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Mapbox access token is configured here. This needs to be called either in your application
// object or in the same activity which contains the mapview.
Mapbox.getInstance(this, getString(R.string.access_token));
// This contains the MapView in XML and needs to be called after the access token is configured.
setContentView(R.layout.activity_location_plugin);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
LocationPluginActivity.this.mapboxMap = mapboxMap;
enableLocationPlugin();
}
});
}
示例8: onCreate
import com.mapbox.mapboxsdk.maps.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Mapbox access token is configured here. This needs to be called either in your application
// object or in the same activity which contains the mapview.
Mapbox.getInstance(this, getString(R.string.access_token));
// This contains the MapView in XML and needs to be called after the access token is configured.
setContentView(R.layout.activity_style_create_hotspots_points);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
addClusteredGeoJsonSource(mapboxMap);
}
});
}
示例9: onCreate
import com.mapbox.mapboxsdk.maps.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Mapbox access token is configured here. This needs to be called either in your application
// object or in the same activity which contains the mapview.
Mapbox.getInstance(this, getString(R.string.access_token));
// This contains the MapView in XML and needs to be called after the access token is configured.
setContentView(R.layout.activity_lab_space_station_location);
// Initialize the map view
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final MapboxMap mapboxMap) {
map = mapboxMap;
callApi();
Toast.makeText(SpaceStationLocationActivity.this, R.string.space_station_toast, Toast.LENGTH_SHORT).show();
}
});
}
示例10: onCreate
import com.mapbox.mapboxsdk.maps.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Mapbox access token is configured here. This needs to be called either in your application
// object or in the same activity which contains the mapview.
Mapbox.getInstance(this, getString(R.string.access_token));
// This contains the MapView in XML and needs to be called after the access token is configured.
setContentView(R.layout.activity_extrusion_rotation);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(@NonNull final MapboxMap map) {
mapboxMap = map;
setupBuildingExtrusionPlugin();
}
});
}
示例11: onCreate
import com.mapbox.mapboxsdk.maps.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Mapbox access token is configured here. This needs to be called either in your application
// object or in the same activity which contains the mapview.
Mapbox.getInstance(this, getString(R.string.access_token));
// This contains the MapView in XML and needs to be called after the access token is configured.
setContentView(R.layout.activity_simplify_polyline);
mapView = (MapView) findViewById(R.id.mapview);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
map = mapboxMap;
new DrawGeoJson().execute();
}
});
}
示例12: onCreate
import com.mapbox.mapboxsdk.maps.MapView; //导入方法依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
// MapBox
Mapbox.getInstance(this, getString(R.string.map_box_token));
mMapView = (MapView) findViewById(R.id.mapView);
mMapView.onCreate(savedInstanceState);
mMapView.getMapAsync(this);
requestPermissions();
mSelectLocationBt = (Button) findViewById(R.id.selectLocationBt);
mSelectLocationBt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent returnIntent = new Intent();
returnIntent.putExtra("lat", mCurrentLocation.getLatitude());
returnIntent.putExtra("lng", mCurrentLocation.getLongitude());
setResult(Activity.RESULT_OK, returnIntent);
finish();
}
});
}
示例13: onCreate
import com.mapbox.mapboxsdk.maps.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_compass_listener);
ButterKnife.bind(this);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(this);
}
示例14: onViewCreated
import com.mapbox.mapboxsdk.maps.MapView; //导入方法依赖的package包/类
@Override
public void onViewCreated(final View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mMapView = (MapView) view.findViewById(R.id.mapview);
mLocService = LocationServices.getLocationServices(getActivity());
mMapView.onCreate(savedInstanceState);
mMapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
mMap = mapboxMap;
mMap.setOnMyLocationChangeListener(FragMap.this);
mMap.setMyLocationEnabled(true);
if (mMap.getMyLocation() != null)
onMyLocationChange(mMap.getMyLocation());
mMap.addMarker(new MarkerOptions().position(mKaabePos).setIcon(IconFactory.getInstance(getActivity()).fromResource(R.drawable.ic_kaabe)));
FloatingActionButton fab = (FloatingActionButton) view.findViewById(R.id.myLocationButton);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mMap.getMyLocation() != null) {
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(mMap.getMyLocation().getLatitude(), mMap.getMyLocation().getLongitude()), 15));
}
}
});
}
});
}
示例15: onCreate
import com.mapbox.mapboxsdk.maps.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MapboxAccountManager.start(this, getString(R.string.access_token));
setContentView(R.layout.activity_main);
locationServices = LocationServices.getLocationServices(MainActivity.this);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
map = mapboxMap;
// Check if user has granted location permission. If they haven't, we request it
// otherwise we enable location tracking.
if (!locationServices.areLocationPermissionsGranted()) {
ActivityCompat.requestPermissions(MainActivity.this, new String[]{
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_FINE_LOCATION}, PERMISSIONS_LOCATION);
} else {
enableLocationTracking();
}
}
});
imageButton = (ImageButton) findViewById(R.id.btnPokeball);
imageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new AlertDialog.Builder(MainActivity.this)
.setTitle("MONSTER CAUGHT!")
.setPositiveButton("OK", null)
.show();
}
});
}