Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- File Db = new File("/data/data/your.package/databases/yourdatabasename");
- Date d = new Date();
- File file = new File("your_destination.db");
- file.setWritable(true);
- copyFile(new FileInputStream(Db), new FileOutputStream(file));
- public static void copyFile(FileInputStream fromFile, FileOutputStream toFile) throws IOException {
- FileChannel fromChannel = null;
- FileChannel toChannel = null;
- try {
- fromChannel = fromFile.getChannel();
- toChannel = toFile.getChannel();
- fromChannel.transferTo(0, fromChannel.size(), toChannel);
- } finally {
- try {
- if (fromChannel != null) {
- fromChannel.close();
- }
- } finally {
- if (toChannel != null) {
- toChannel.close();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement