Android的 - 引用其他文件夹 [英] Android - Referencing Additional Folders
本文介绍了Android的 - 引用其他文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的,我想在我的Android项目中使用.txt文件的目录。我试图将它们添加到项目目录,并从那里引用它们,但似乎它不知道它们的存在。
I have a directory of .txt files that I would like to use in my Android project. I have tried adding them to the project directory and referencing them from there but it seems that it doesnt know they exist.
我知道我可以把他们的文件夹中原材料
但我有一些.wav文件中有问题,宁愿把它们存储在其他地方。
I know I can put them in the folder raw
but i have some .wav files in there and would rather store them somewhere else.
有什么建议?
推荐答案
把它们放在一个名为资产
文件夹中:
Put them in a folder called assets
:
您现在可以访问您的文件是这样的:
You can now access your files like this:
String file = "folder/mytext.txt";
InputStream input = context.getAssets().open(file);
另请参见文档。
这篇关于Android的 - 引用其他文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文