【发布时间】:2014-03-20 15:27:30
【问题描述】:
我有一个名为“high.txt”的文本文件。我需要我的 Android 应用程序内部的数据。但我完全不知道如何将它读入字符串的 ArrayList。我尝试了在 Java 中执行此操作的正常方法,但显然这在 Android 中不起作用,因为它找不到文件。那么我该怎么做呢?我已经把它放在我的 res 文件夹中了。但是,您如何获取在 Android 中打开文件所获得的输入流并将其读入字符串的 ArrayList。我被困在那部分了。
基本上它看起来像这样:
3. What do you do for an upcoming test?
L: make sure I know what I'm studying and really review and study for this thing. Its what Im good at. Understand the material really well.
CL: Time to study. I got this, but I really need to make sure I know it,
M: Tests can be tough, but there are tips and tricks. Focus on the important, interesting stuff. Cram in all the little details just to get past this test.
CR: -sigh- I don't like these tests. Hope I've studied enough to pass or maybe do well.
R: Screw the test. I'll study later, day before should be good.
这是一个示例问题,所有行都将作为单独的字符串存储在数组列表中。
【问题讨论】:
-
将文件放在原始xml res文件夹中,并使用openRawResource访问它。 developer.android.com/guide/topics/resources/…
标签: java android file android-file