I want to copy file from SD-Card to app's assets folder in android.Please help me to do it programmatically.

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top