public static OsmMBTileSource createFromFile(File file){
  SQLiteDatabase db;
  int flags=SQLiteDatabase.NO_LOCALIZED_COLLATORS | SQLiteDatabase.OPEN_READONLY;
  int value;
  int minZoomLevel;
  int maxZoomLevel;
  int tileSize=tileSizePixels;
  InputStream is=null;
  db=SQLiteDatabase.openDatabase(file.getAbsolutePath(),null,flags);
  value=getInt(db,"SELECT MIN(zoom_level) FROM tiles;");
  minZoomLevel=value > -1 ? value : minZoom;
  value=getInt(db,"SELECT MAX(zoom_level) FROM tiles;");
  maxZoomLevel=value > -1 ? value : maxZoom;
  Cursor cursor=db.rawQuery("SELECT tile_data FROM images LIMIT 0,1",new String[]{});
  if (cursor.getCount() != 0) {
    cursor.moveToFirst();
    is=new ByteArrayInputStream(cursor.getBlob(0));
    Bitmap bitmap=BitmapFactory.decodeStream(is);
    tileSize=bitmap.getHeight();
    Log.w(t,String.format("Found a tile size of %d",tileSize));
  }
  cursor.close();
  return new OsmMBTileSource(minZoomLevel,maxZoomLevel,tileSize,file,db);
}

public static OsmMBTileSource createFromFile ( File file ) { SQLiteDatabase db ; int flags = SQLiteDatabase . NO_LOCALIZED_COLLATORS | SQLiteDatabase . OPEN_READONLY ; int value ; int minZoomLevel ; int maxZoomLevel ; int tileSize = tileSizePixels ; InputStream is = null ; db = SQLiteDatabase . openDatabase ( file . getAbsolutePath ( ) , null , flags ) ; value = getInt ( db , "SELECT MIN(zoom_level) FROM tiles;" ) ; minZoomLevel = value > - 1 ? value : minZoom ; value = getInt ( db , "SELECT MAX(zoom_level) FROM tiles;" ) ; maxZoomLevel = value > - 1 ? value : maxZoom ; Cursor cursor = db . rawQuery ( "SELECT tile_data FROM images LIMIT 0,1" , new String [ ] { } ) ; if ( cursor . getCount ( ) != 0 ) { cursor . moveToFirst ( ) ; is = new ByteArrayInputStream ( cursor . getBlob ( 0 ) ) ; Bitmap bitmap = BitmapFactory . decodeStream ( is ) ; tileSize = bitmap . getHeight ( ) ; Log . w ( t , String . format ( "Found a tile size of %d" , tileSize ) ) ; } cursor . close ( ) ; return new OsmMBTileSource ( minZoomLevel , maxZoomLevel , tileSize , file , db ) ; }
creates a new mbtilesource from file . parameters minzoom , maxzoom en tilesizepixels are obtained from the database . if they cannot be obtained from the db , the default values as defined by this class are used .
