I have an app that writes to text files onto Internal storage. I'd like to take a close look on my computer.
I ran a Toast.makeText to display the path, it says: /data/data/mypackage
But when I go to Android Studio's Android Device Monitor application, I don't see /data/data in the File Explorer. So where are my files?
I know they exist because I can find the on adb shell. I need to translate /data/data to a path visible on File Explorer, so that I can download them easily. Thanks!
You can only check that if you have a rooted phone, because these folders are private to applications and usual access is restricted to such folders. I would advise if you dont have a rooted phone then make a copy of your internal folders and write them to your SDCard to check the contents. The other way is to root your phone or use an Emulator.
Here is the code you can use to write a copy on your External SDCard:
public static void copyDirectoryOneLocationToAnotherLocation(File sourceLocation, File targetLocation)
throws IOException {
if (sourceLocation.isDirectory()) {
if (!targetLocation.exists()) {
targetLocation.mkdir();
}
String[] children = sourceLocation.list();
for (int i = 0; i < sourceLocation.listFiles().length; i++) {
copyDirectoryOneLocationToAnotherLocation(new File(sourceLocation, children[i]),
new File(targetLocation, children[i]));
}
} else {
InputStream in = new FileInputStream(sourceLocation);
OutputStream out = new FileOutputStream(targetLocation);
// Copy the bits from instream to outstream
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
in.close();
out.close();
}
}
You can use the adb console
.
Just write adb root
and thenadb connect <IP>
After that you can open the data folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With