private void copyDatabaseFromAssets() throws SQLiteAssetException { Log.w(TAG, "copying database from assets..."); try { InputStream zipFileStream = mContext.getAssets().open(mArchivePath); File f = new File(mDatabasePath + "/"); if (!f.exists()) { f.mkdir(); } ZipInputStream zis = getFileFromZip(zipFileStream); if (zis == null) { throw new SQLiteAssetException("Archive is missing a SQLite database file"); } writeExtractedFileToDisk(zis, new FileOutputStream(mDatabasePath + "/" + mName)); Log.w(TAG, "database copy complete"); } catch (FileNotFoundException fe) { SQLiteAssetException se = new SQLiteAssetException("Missing " + mArchivePath + " file in assets"); se.setStackTrace(fe.getStackTrace()); throw se; } catch (IOException e) { SQLiteAssetException se = new SQLiteAssetException("Unable to extract " + mArchivePath + " to data directory"); se.setStackTrace(e.getStackTrace()); throw se; } }