Файл timetable.csv находится в том же каталоге, что и файл MainActivity.java. Я использовал следующую функцию.
public void getaction(String date, TextView action1) {
String line = "";
String[] football = new String[20];
try {
System.out.print("Hello");
BufferedReader br = new BufferedReader(new FileReader("timetable.csv"));
String headerLine = br.readLine();
System.out.print("Hello");
while ((line = br.readLine()) != null) {
football = line.split(",");
//match the date
if (football[0].equals(date)){
action1.setText("i found chelsea");
}else{
action1.setText("I did not find Chelsea!");
}
}
}
catch(Exception io){
System.out.println(io);
}
action1.setText("I did too find Chelsea!");
}
Это дало следующую ошибку:
I/System.out: Hellojava.io.FileNotFoundException: timetable.csv (No such file or directory)




Вам нужно создать папку ресурсы в модуле приложения. Вставьте туда свой файл .csv. Затем вы можете прочитать такой файл
try
{
reader = new BufferedReader(
new InputStreamReader(getAssets().open("filename.csv")));
......
}
catch (Exception e)
{
......
}