One can surely retreive database .db file from Android Device programmatically. I used to put one more setting under my application named Developer Options which copy .db file into sdCard.
Following code copy .db to sdcard. Change your copied .db file name into whatever like to with backupDBPath and currentDBPath (Name which you gave to your database name).
public void dev()
{
try {
File sd = Environment.getExternalStorageDirectory();
File data = Environment.getDataDirectory();
if (sd.canWrite()) {
String currentDBPath = "/data/data/" + getPackageName() + "/databases/ZnameDB";
String backupDBPath = "ZnameDB_Dev.db";
File currentDB = new File(currentDBPath);
File backupDB = new File(sd, backupDBPath);
if (currentDB.exists()) {
FileChannel src = new FileInputStream(currentDB).getChannel();
FileChannel dst = new FileOutputStream(backupDB).getChannel();
dst.transferFrom(src, 0, src.size());
src.close();
dst.close();
Toast.makeText(SettingsActivity.this, "Database Transfered!", Toast.LENGTH_SHORT).show();
}
}
} catch (Exception e) {
Log.e(TAG, e.toString());
}
}
There are many application available in PlayStore with which you can view your .db file. I used aSQLiteManager android application to view .db file.