views:

8

answers:

0

I'm trying to write a file to the Android database directory and I keep getting this exception. Here's the chunk of code that's blowing up:

File database = new File(mDbPath);
                database.createNewFile();
                File backup = new File(sdPath, mRestoreFileName);

                if (database.exists()) {
                    FileChannel src = new FileOutputStream(backup).getChannel();
                    FileChannel dst = new FileInputStream(database).getChannel();

                    dst.transferFrom(src, 0, src.size());

                    src.close();
                    dst.close();
                }