SceneView mapView = findViewById(R.id.arcgis);
ArcGISScene arcGISMap = new ArcGISScene(new Basemap());
mapView.setScene(arcGISMap);
String path = FileUtil.getInstance().getMapTpkPath() + "dixing.tpk";
TileCache tileCache = new TileCache(path);
tileCache.loadAsync();
tileCache.addDoneLoadingListener(() -> {
if(tileCache.getLoadStatus() == LoadStatus.LOADED){
ArcGISTiledLayer arcGISTiledLayer = new ArcGISTiledLayer(tileCache);
arcGISTiledLayer.loadAsync();
if(arcGISTiledLayer.getLoadStatus() == LoadStatus.LOADED){
arcGISMap.getBasemap().getBaseLayers().add(arcGISTiledLayer);
mapView.setViewpoint(new Viewpoint(arcGISTiledLayer.getFullExtent()));
}else {
ArcGISRuntimeException exception = arcGISTiledLayer.getLoadError();
System.out.println();
}
}else {
ArcGISRuntimeException exception = tileCache.getLoadError();
System.out.println();
}
});
MapView mapView = findViewById(R.id.mapView);
ArcGISMap arcGISMap = new ArcGISMap(new Basemap());
mapView.setMap(arcGISMap);
String path = FileUtil.getInstance().getMapTpkPath() + "dixing.tpk";
TileCache tileCache = new TileCache(path);
tileCache.loadAsync();
tileCache.addDoneLoadingListener(() -> {
if(tileCache.getLoadStatus() == LoadStatus.LOADED){
ArcGISTiledLayer arcGISTiledLayer = new ArcGISTiledLayer(tileCache);
arcGISTiledLayer.loadAsync();
if(arcGISTiledLayer.getLoadStatus() == LoadStatus.LOADED){
arcGISMap.getBasemap().getBaseLayers().add(arcGISTiledLayer);
mapView.setViewpoint(new Viewpoint(arcGISTiledLayer.getFullExtent()));
}else {
ArcGISRuntimeException exception = arcGISTiledLayer.getLoadError();
System.out.println();
}
}else {
ArcGISRuntimeException exception = tileCache.getLoadError();
System.out.println();
}
});
https://blog.csdn.net/hejunfeng814/article/details/78835497
楼主你好 我也遇到了这个问题 请问你解决了吗