当前位置: 首页>>代码示例>>Java>>正文


Java Mapbox.getInstance方法代码示例

本文整理汇总了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);
}
 
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:23,代码来源:NavigationApplication.java

示例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();
}
 
开发者ID:mapbox,项目名称:mapbox-plugins-android,代码行数:22,代码来源:PluginApplication.java

示例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);
    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:21,代码来源:BuildingPluginActivity.java

示例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);
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:18,代码来源:SnapshotNotificationActivity.java

示例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;

    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:22,代码来源:LanguageSwitchActivity.java

示例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);
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:19,代码来源:SymbolLayerMapillaryActivity.java

示例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.

    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:23,代码来源:MapboxStudioStyleActivity.java

示例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();
    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:22,代码来源:RotationExtrusionActivity.java

示例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);
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:18,代码来源:GeoJsonPluginActivity.java

示例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();

    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:24,代码来源:SimplifyPolylineActivity.java

示例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();
    }
  });
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:26,代码来源:MarathonExtrusionActivity.java

示例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);
}
 
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:22,代码来源:OptimizationActivity.java

示例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();
        }
    });
}
 
开发者ID:VitorPoncell,项目名称:poturnoChat,代码行数:29,代码来源:MapActivity.java

示例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();
}
 
开发者ID:faviotorres,项目名称:AcopioMX,代码行数:13,代码来源:ActivityHome.java

示例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);
}
 
开发者ID:Turistforeningen,项目名称:SjekkUT,代码行数:38,代码来源:SjekkUTApplication.java


注:本文中的com.mapbox.mapboxsdk.Mapbox.getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。