How to get FileInputStream for internal memory files ?

Put your problem here if it does not fit any of the other categories.

How to get FileInputStream for internal memory files ?

Postby mob_king » Tue Jan 11, 2011 10:01 am

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.)

P.S. ==>
Oh! Actually the problem seems to be the file permission. It gives -rwxrwx--- . So myapp won't have any access to read that file. As the file was created by camera activity as a result for startActivityForResult() for MediaStore.ACTION_IMAGE_CAPTURE intent. So is there any way I can change this permissions ? As camera app and myapp are in different groups.
mob_king
Developer
Developer
 
Posts: 35
Joined: Mon Apr 12, 2010 5:19 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 21 guests