Question

I am trying to access a csv file from the assets for my app and all I get is FileNotFoundException. I get the same when I try to access it from elsewhere. Any idea what I should be doing here? Log messages work just fine until then. The error on the logcat is as follows.

Tag Text System.err java.io.FileNotFoundException C:\Users.....\assets\cms.csv: open failed ENOENT (no such file or directory)

for the code:

br = new BufferedReader(new FileReader
("C:\\Users\\Srihari\\workspace\\CMSHealthcare\\assets\\cms.csv"));

Any help is appreciated!

Thanks in advance!

Was it helpful?

Solution

Dont point it to the file system on your computer...instead use the getAssets method to target the filesytem in the raw folder that gets bundled into your apk (the binary of the app)

    br = new BufferedReader(new InputStreamReader(getAssets().open("cms.csv"))); 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top