Can't Find Created File
I'm writing my little app for Android. I'm trying to create files. Here is a code snippet: final String TESTSTRING = new String('Hello Android'); FileOutputStream
Solution 1:
The file is located in /data/data/com.yourpackagename/files/filename.txt which is hidden unless the device is rooted. You can access the file by copying it from the directory where it is created.
From the command line:
To copy a file
adb -d shell
run-as com.yourpackagename
cat /data/data/com.yourpackagename/files/filename.txt > /sdcard/filename.txt
Alternatively for a SQLite database
cat /data/data/com.yourpackagename/databases/dbname.db > /sdcard/dbname.sqlite
This solution will work without having to root the device.
Solution 2:
It is created in /data/data/your.package.name/files
. However, this directory is not visible for file mangagers (unless they have root rights).
Solution 3:
You can get the path of the files created using openFileOutput(name)
using getFileStreamPath(name)
. But file manager apps will need root privileges to view this path.
Post a Comment for "Can't Find Created File"