Sarit Adhikari Sarit Adhikari - 1 year ago 142
Android Question

Reading CSV file in resources folder android

I am developing an android app in netbeans. I am trying to read CSV file using opencsv. When I put the file in resources folder and try to read it from there, there's an error while building saying invalid resource directory. Where should I store csv file so that it can be read each time the app starts?

Answer Source

you should put csv file in assets folder ..

InputStreamReader is = new InputStreamReader(getAssets()

                BufferedReader reader = new BufferedReader(is);
                String line;
                while ((line = reader.readLine()) != null) {

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download