在资源文件夹Android中读取CSV文件 [英] Reading CSV file in resources folder android
本文介绍了在资源文件夹Android中读取CSV文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在用netbeans开发一个Android应用程序.我正在尝试使用opencsv读取CSV文件.当我将文件放在资源文件夹中并尝试从那里读取文件时,在生成无效资源目录时出现错误.我应该将csv文件存储在哪里,以便每次应用启动时都可以读取它?
I am developing an android app in netbeans. I am trying to read CSV file using opencsv. When I put the file in resources folder and try to read it from there, there's an error while building saying invalid resource directory. Where should I store csv file so that it can be read each time the app starts?
推荐答案
您应将csv文件放在资产文件夹中..
you should put csv file in assets folder ..
InputStreamReader is = new InputStreamReader(getAssets()
.open("filename.csv"));
BufferedReader reader = new BufferedReader(is);
reader.readLine();
String line;
while ((line = reader.readLine()) != null) {
}
这篇关于在资源文件夹Android中读取CSV文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文