本文整理汇总了Java中com.mapbox.mapboxsdk.Mapbox.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java Mapbox.getInstance方法的具体用法?Java Mapbox.getInstance怎么用?Java Mapbox.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mapbox.mapboxsdk.Mapbox
的用法示例。
在下文中一共展示了Mapbox.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.mapbox.mapboxsdk.Mapbox; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
// Leak canary
if (LeakCanary.isInAnalyzerProcess(this)) {
return;
}
LeakCanary.install(this);
if (BuildConfig.DEBUG) {
Timber.plant(new Timber.DebugTree());
}
// Set access token
String mapboxAccessToken = Utils.getMapboxAccessToken(getApplicationContext());
if (TextUtils.isEmpty(mapboxAccessToken) || mapboxAccessToken.equals(DEFAULT_MAPBOX_ACCESS_TOKEN)) {
Log.w(LOG_TAG, "Warning: access token isn't set.");
}
Mapbox.getInstance(getApplicationContext(), mapboxAccessToken);
}
示例2: onCreate
import com.mapbox.mapboxsdk.Mapbox; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
if (LeakCanary.isInAnalyzerProcess(this)) {
// This process is dedicated to LeakCanary for heap analysis.
// You should not init your app in this process.
return;
}
if (BuildConfig.DEBUG) {
Timber.plant(new Timber.DebugTree());
}
LeakCanary.install(this);
initializeLogger();
Mapbox.getInstance(this, getString(R.string.mapbox_access_token));
Timber.plant(new Timber.DebugTree());
// TODO remove when 5.2.1 is released
FileSource.getInstance(this).activate();
}
示例3: onCreate
import com.mapbox.mapboxsdk.Mapbox; //导入方法依赖的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));
setContentView(R.layout.activity_building_plugin);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(@NonNull final MapboxMap map) {
buildingPlugin = new BuildingPlugin(mapView, map);
buildingPlugin.setVisibility(true);
}
});
}
示例4: onCreate
import com.mapbox.mapboxsdk.Mapbox; //导入方法依赖的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_snapshot_notification);
mapView = findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
// Set a callback for when MapboxMap is ready to be used
mapView.getMapAsync(this);
}
示例5: onCreate
import com.mapbox.mapboxsdk.Mapbox; //导入方法依赖的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_language_switch);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
map = mapboxMap;
}
});
}
示例6: onCreate
import com.mapbox.mapboxsdk.Mapbox; //导入方法依赖的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_symbol_layer_mapillary);
recyclerView = findViewById(R.id.rv_on_top_of_map);
// Initialize the map view
mapView = findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(this);
}
示例7: onCreate
import com.mapbox.mapboxsdk.Mapbox; //导入方法依赖的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_mapbox_studio);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
// Customize map with markers, polylines, etc.
}
});
}
示例8: onCreate
import com.mapbox.mapboxsdk.Mapbox; //导入方法依赖的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();
}
});
}
示例9: onCreate
import com.mapbox.mapboxsdk.Mapbox; //导入方法依赖的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);
}
示例10: onCreate
import com.mapbox.mapboxsdk.Mapbox; //导入方法依赖的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();
}
});
}
示例11: onCreate
import com.mapbox.mapboxsdk.Mapbox; //导入方法依赖的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_marathon_extrusion);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
MarathonExtrusionActivity.this.mapboxMap = mapboxMap;
// Add the marathon route source to the map
GeoJsonSource courseRouteGeoJson = new GeoJsonSource("coursedata", loadJsonFromAsset("marathon_route.geojson"));
mapboxMap.addSource(courseRouteGeoJson);
addExtrusionsLayerToMap();
}
});
}
示例12: onCreate
import com.mapbox.mapboxsdk.Mapbox; //导入方法依赖的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_optimization);
stops = new ArrayList<>();
// Add the origin Position to the list
addFirstStopToStopsList();
// Setup the MapView
mapView = findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(this);
}
示例13: onCreate
import com.mapbox.mapboxsdk.Mapbox; //导入方法依赖的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();
}
});
}
示例14: onCreate
import com.mapbox.mapboxsdk.Mapbox; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Mapbox.getInstance(this, Client.MAPBOX_TOKEN);
setContentView(R.layout.activity_home);
ButterKnife.bind(this);
setupToolbar(toolbar, "Ayuda Sismo MX", false);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(this);
initialize();
initializeUI();
}
示例15: onCreate
import com.mapbox.mapboxsdk.Mapbox; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
if (LeakCanary.isInAnalyzerProcess(this)) {
return;
}
refWatcher = LeakCanary.install(this);
instance = this;
Realm.init(this);
RealmConfiguration realmConfiguration = new RealmConfiguration.Builder()
.name(getString(R.string.realm_database_name))
.schemaVersion(Long.parseLong(getString(R.string.realm_database_schemaversion)))
.deleteRealmIfMigrationNeeded()
.build();
Realm.setDefaultConfiguration(realmConfiguration);
if (BuildConfig.DEBUG) {
Timber.plant(new Timber.DebugTree());
Stetho.initializeWithDefaults(this);
}
Picasso.setSingletonInstance(new Picasso.Builder(this)
.downloader(new OkHttp3Downloader(OkHttpSingleton.getClient()))
.build());
FacebookSdk.sdkInitialize(getApplicationContext());
AppEventsLogger.activateApp(this);
Mapbox.getInstance(this, getResources().getString(R.string.mapbox_token));
Config config = new Config(getResources().getString(R.string.uservoice_site));
config.setTopicId(getResources().getInteger(R.integer.uservoice_topic_id));
config.setShowForum(false);
config.setShowKnowledgeBase(false);
config.setShowPostIdea(false);
if (PreferenceUtils.hasUserId(this) && PreferenceUtils.hasUserFullname(this) && PreferenceUtils.hasUserEmail(this)) {
config.identifyUser(PreferenceUtils.getUserId(this), PreferenceUtils.getUserFullname(this), PreferenceUtils.getUserEmail(this));
}
UserVoice.init(config, this);
Raven.init(this);
Utils.setRavenUser(this);
}