简体   繁体   中英

Android: Copy file from sdcard to app's assets folder programmatically

我想将文件从SD卡复制到android中的应用的资产文件夹中,请以编程方式帮助我。

Unfortunately, you can´t. The apps assets folder is readable only, so you cant programmatically store (write) your data there.

(Taken from AssetManager Doc ):

This class presents a lower-level API that allows you to open and read raw files that have been bundled with the application as a simple stream of bytes.

Also, see Managing Projects | Android Developers :

assets/ This is empty. You can use it to store raw asset files . Files that you save here are compiled into an .apk file as-is, and the original filename is preserved. You can navigate this directory in the same way as a typical file system using URIs and read files as a stream of bytes using the AssetManager. For example, this is a good location for textures and game data.

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