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


Java MapView.onCreate方法代码示例

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


}
 
开发者ID:metinkale38,项目名称:prayer-times-android,代码行数:35,代码来源:FragMap.java

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


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