What is the differnce between accessing file from assets folder or SD card

烈酒焚心 提交于 2019-12-04 14:21:47

问题


I am developing an application where I have to use three different size's file (1mb, 5mb, 15mb). I searched, then came to know that we can keep these video in assets folder and can use those video.

Secondly, I came to know that we can keep these videos in assets folder and installation time we can move all videos to SD card. when tried second approach faced problem due to bigger file size.

So, can anyone please tell me what is difference between both approaches and which one I should use. Any pointer will be appreciated.


回答1:


Files over 1mb placed in the assets folder won't be readable from your app (It'll throw an exception).

This is because they get compressed during the build process, and thus the phone requires substantial resources to uncompress them when on the handset.

If the asset is compressed, the system has to uncompress the entire thing to memory. If you have a 20MB asset, that means 20MB of physical memory is tied up by your application.

I believe you can place them in the raw folder, where they won't get compressed.

EDIT :

You can upload upto 50MB file sized APK to android market, that is standard and it is now giving support to bigger sized APK's too. See below reference link for this:

Android Apps Break the 50MB Barrier

Thanks.



来源:https://stackoverflow.com/questions/14258395/what-is-the-differnce-between-accessing-file-from-assets-folder-or-sd-card

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!