Possible Duplicate:
Get and Parse CSV file in android
I would like to store a csv file in android app itself & it should be called for read & later print the values according to the requirements.I definitely want the csv file to be called inside the app not outside the app[SD Card].Any examples on this will be really helpful.Thanks
I have something like this;
public final List<String[]> readCsv(Context context) {
List<String[]> questionList = new ArrayList<String[]>();
AssetManager assetManager = context.getAssets();
try {
InputStream csvStream = assetManager.open(CSV_PATH);
InputStreamReader csvStreamReader = new InputStreamReader(csvStream);
CSVReader csvReader = new CSVReader(csvStreamReader);
String[] line;
// throw away the header
csvReader.readNext();
while ((line = csvReader.readNext()) != null) {
questionList.add(line);
}
} catch (IOException e) {
e.printStackTrace();
}
return questionList;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With