I cannot find my application folder on my phone after deployment.
Is there any easy way to view or search for a package on the phone?
I have searched data\data\
but found no inner folder nor my application package.
I then tried to copy the db file to the sd card
but my sd.canWrite()
returns false
I guess because it doesn't exist.
How can I fix this? or can I view the DB in my intelliJ
easily without copying the db file?
public void exportDatabase(String databaseName) {
try {
File sd = Environment.getExternalStorageDirectory();
File data = Environment.getDataDirectory();
if (sd.canWrite()) {
String currentDBPath = "//data//"+context.getPackageName()+"//databases//"+databaseName+"";
String backupDBPath = "dontacllDB.db";
File currentDB = new File(data, 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();
}
}
} catch (Exception e) {
}
}
Aucun commentaire:
Enregistrer un commentaire