question: private void createFromAssets ( String myDBName , File dbfile , InputStream assetFileInputStream ) { OutputStream out = null ; try { String dbPath = dbfile . getAbsolutePath ( ) ; dbPath = dbPath . substring ( 0 , dbPath . lastIndexOf ( "/" ) + 1 ) ; File dbPathFile = new File ( dbPath ) ; if ( ! dbPathFile . exists ( ) ) dbPathFile . mkdirs ( ) ; File newDbFile = new File ( dbPath + myDBName ) ; out = new FileOutputStream ( newDbFile ) ; byte [ ] buf = new byte [ 1024 ] ; int len ; while ( ( len = assetFileInputStream . read ( buf ) ) > 0 ) out . write ( buf , 0 , len ) ; Log . v ( "info" , "Copied pre-populated DB content to: " + newDbFile . getAbsolutePath ( ) ) ; } catch ( IOException ex ) { Log . v ( "createFromAssets" , "No pre-populated DB found, error=" + ex . getMessage ( ) ) ; } finally { if ( out != null ) { try { out . close ( ) ; } catch ( IOException ignored ) { } } } }
target:  If a prepopulated DB file exists in the assets folder it is copied to the dbPath. Only runs the first time the app runs.