I´m trying to open a csv file inside a android project. Inside the res folder I created a new folder named raw.
This is my code:
public File readFromFile(){
URL url = DemoReader.class.getResource("/res/raw/demosystemsoverview.csv");
if (url == null) {
throw new IllegalArgumentException("file is not found!");
} else {
File f = new File(url.getFile());
if (f.exists()){
return f;
}else{
throw new IllegalArgumentException("file does not exist!");
}
}
}
I don´t get the file not found exception but I get the file does not exist exception. My goal is to use a bufferedReader but I think I have to solve this before.