简体   繁体   中英

How to open a document stored in my application data folder in android

I have a document file stored in my application's data folder, which is a kind of private folder to the application. It is a .doc file. I have doc viewer application installed in the device. Now, how can I open the file with the Action_view intent. As the viewer application can't access file stored in my application data folder, it is throwing an error saying file can't be accessed. I have no interest to copy the file to phone public folders like sdcard. Is there anyway to open that doc file. Any clue on embeded apk in android.

Thanks & regards,

Suman

You can't do this directly. Either copy the file temporarily to the SD card (external storage) or set permission temporarily to WORLD_READABLE . There are no embedded APKs in Android, but if the viewer is available as library you can include it in your app. Of course the problem with changing permissions temporarily is that you don't really get notified when the user has finished viewing it, etc.

The whole thing begs the question: why is it a private file if it needs to be viewed by third party applications? If it is meant for the user of the device, there is not much point in hiding it from them...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM