i am trying to export the SQLite database from my application so that i could do a Export/Import feature for my application.
I am using the example from here & here for attempting to export the SQLite database (/data/data/com.example.worldcountriesbooks/databases/group.db) out of the Android device (Samsung Galaxy Note), Android 4.0.3 but i keep getting this error
12-14 00:56:33.722: I/Failed(14850): java.io.FileNotFoundException: /data/data/com.example.worldcountriesbooks/databases/group.db: open failed: ENOENT (No such file or directory)
I have also attempted to add the WRITE_EXTERNAL_STORAGE & WRITE_MEDIA_STORAGE into the manifest file but it doesn't work. I am able to browse to the actual file on my Android device as it is rooted but i can't read it with my application. Any idea why?
Sample code:
    try {
        File sd = Environment.getExternalStorageDirectory();
        File data = Environment.getDataDirectory();
        if (sd.canWrite()) {
            String currentDBPath = "//data//com.example.worldcountriesbooks/databases//group.db";
            String backupDBPath = "//mnt//sdcard//database.db";
            File currentDB = new File(data, currentDBPath);
            File backupDB = new File(sd, backupDBPath);
            FileChannel src = new FileInputStream(currentDB).getChannel();
            FileChannel dst = new FileOutputStream(backupDB).getChannel();
            dst.transferFrom(src, 0, src.size());
            src.close();
            dst.close();
            Toast.makeText(getBaseContext(), backupDB.toString(),
                    Toast.LENGTH_LONG).show();
        }
    } catch (Exception e) {
        Toast.makeText(getBaseContext(), e.toString(), Toast.LENGTH_LONG)
                .show();
    }