I use the opencsv library to read the contents of a .csv file
I have the following:
String fileName = "file:///storage/sdcard1/maptest/cvs_test1.cvs";
final File file = new File(Uri.parse(fileName).getPath());
try {
CSVReader reader = new CSVReader(new FileReader(file), ',', '"', 1);
//Read CSV line by line and use the string array as you want
String[] nextLine;
try {
while ((nextLine = reader.readNext()) != null) {
if (nextLine != null) {
//Verifying the read data here
System.out.println(Arrays.toString(nextLine));
}
}
} catch (IOException e) {
e.printStackTrace();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
I try to detect if a line is blank and thus jump to the next one