【发布时间】:2012-07-18 14:58:33
【问题描述】:
我正在尝试让 android 从 R.raw 文件夹中已有的文本文件中读取。
我有函数 void readfile(Context context) 包含该行
InputStream is = context.getResources().openRawResource(R.raw.data);
但是,当我尝试运行该应用程序时,它会在该行崩溃。你能告诉我一个解决方法吗?还是从该文件中读取的另一种方式?
【问题讨论】:
-
可能是
context is null....add your logcat
标签: android file text android-resources android-context