private void selectMBTilesBasemap(String mbtilesPath) { File mbtilesFile = new File(mbtilesPath); if(!mbtilesFile.exists()) { AlertDialog.Builder builder = new AlertDialog.Builder(mapActivity); builder.setTitle("Offline Basemap Not Found"); builder.setMessage("Please check out a deployment or add MBTiles files to " + ExternalStorage.getMBTilesDir()); builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { //placeholder } }); AlertDialog dialog = builder.create(); dialog.show(); return; } //add mbtiles to map MBTilesLayer mbTilesLayer = new MBTilesLayer(mbtilesFile); mapView.setTileSource(mbTilesLayer); setSelectedBasemap(mbtilesPath); // if we set an MBTiles from a DeploymentDetails, the map may not start panned to the bounds if (needsBoundsChecking) { BoundingBox bbox = mbTilesLayer.getBoundingBox(); mapView.zoomToBoundingBox(bbox); needsBoundsChecking = false; } }