简体   繁体   中英

Android - How to package documents into an app

I'm trying to create an app and have the ability to save files to /data/data/(packagename)/files or a directory similar to that. The goal would be to have a pdf or doc handler, as necessary, open the files stored on the internal storage and be viewed by the user. I have the code to get a pdf reader that is installed and display the file but I do not know how to package the files so they are installed in a directory like the one above. Also, if I am able to do this would I use getResources to access the files? How should the file structure look in eclipse to make this happen on install of the APK?

I do prefer to have the files stored internally (they are small) and not on the SD card.

I admit I am new to this and am trying to learn as I go. Thanks for the help!

As I understand your approach you only need to place your files to assets folder of your application and then just copy them to the internal storage. Read more here .

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