Android的 - 从资产将文件复制到/数据/数据​​文件夹 [英] Android - Copy files from assets to /data/data folder

查看:196
本文介绍了Android的 - 从资产将文件复制到/数据/数据​​文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在我的应用程序使用的一些文件。它们都保存在资源文件夹。我看到那里的文件正在从资产文件夹中复制到/ data / /在内部存储,然后使用数据上SO,讨论。
我得到的code,但我不明白的是,什么是必要的资产复制到内部存储?
如果有人有经验,用这个,救命啊!

I need to use some files in my app. They are kept in asset folder. I saw discussions on SO, where the files are being copied from asset folder, to /data/data/ on the internal storage, and then being used. I get the code, but what I do not get is, what is the need to copy the assets to internal storage ? If anybody has experience with this, help !

推荐答案

这只是弹出了我一个理由使用现有的C / C ++ code。与NDK时,需要到文件的路径和你不要修改code。

One reason that just popped up for me is when using existing C/C++ code with NDK that requires a path to a file and you don't want to modify that code.

例如,我使用的是需要一些数据文件和目前唯一的接口是一些负载(字符*路径)现有的C库函数。

For example, I'm using an existing C library that needs some data files and the only existing interface is some "load( char* path )" function.

也许实际上有一些更好的方法,但我还没有发现任何尚未。

Perhaps there is actually some better method but I have not found any yet.

这篇关于Android的 - 从资产将文件复制到/数据/数据​​文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆