How to get FileInputStream for file in internal memory in android which is not inside applications default file directory.
I have created new directory in my application space. So openFileInput("filename")
will only work for files in getFilesDir()
. And openFileInput("filename")
do not accept argument with path separaters "/" so I can change it to ../myfolder/.
Is there any way to get a FileInputStream
on this ? ..
Note: Using normal APIs File = new File(... ) gives permission denied errors. And I have already created given Context.MODE_WORLD_WRITEABLE as the permission for my custom folder.
To make it clear :
My file is here ==> /data/data/com.app.package/app_myfolder/file1.tmp
where
"myfolder" ==> is created with Context.MODE_WORLD_WRITEABLE
permissions.
I want to open FileInputStream
on file1.tmp
. (Normally your files are here /data/data/com.app.package/files/file1.tmp
and getFilesDir()
points to this directory, so also openFileInput("")
takes argument which exist in same default directory.)
You can't, unless the file in question is created using
openFileOutput()
withMODE_WORLD_READABLE
, and that's not a very good idea (since any app can now read that file).The camera activity should be storing the file out on external storage, not internal storage. Use the EXTRA_OUTPUT extra to indicate where the file should go.
Assuming "camera activity" is referring to the one in the Android firmware, you will need to modify the firmware.