如何在应用程序的 APK 中包含数据文件? [英] How to include data files with the app's APK?

查看:38
本文介绍了如何在应用程序的 APK 中包含数据文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在安装我的 Android 应用程序时创建一些预先创建的文件.

I want to create some pre-created files when my Android application is installed.

我想在内部存储器 (data/data//files/) 和新创建的 sdcard 目录 (/sdcard//data1/) 中创建文件.

I would like to create the file in both the internal memory (data/data//files/) and in a newly created sdcard directories (/sdcard//data1/).

我该怎么做?

推荐答案

您可以将文件保存在 es aw 中,并编写代码将此文件存储到所需位置(如果没有)应用启动时存在.
检查this以访问内部存储器和sdcard
并使用以下

You can save you files in es aw and write the code to store this files to the desired locations if it does not exist when the app start.
Check this to access the internal memory and sdcard
and access the raw file using the following

InputStream databaseInputStream = getResources().openRawResource(R.raw.yourfile);

这篇关于如何在应用程序的 APK 中包含数据文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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