-2

I have this CSV file format:

"1", "testing <[image|media]>" , "1"

how can to read it from sdcard and put the parsed data in a listview or textview in Android?

2
  • 2
    You should use OpenCSV for parsing the CSV data. Commented Dec 20, 2011 at 10:38
  • Adopt CSV Reader to your code,it will be a much simpler solution code rather than the other one. Commented Dec 20, 2011 at 12:52

2 Answers 2

2

You can use java.io.Reader and split string on ","

Sign up to request clarification or add additional context in comments.

2 Comments

Please be more elaborate. Clearly, the OP has no clue about those if he's asking this question....Also, A simple split might not work. What if the data has a double quote in it?
if the data has double quote or anything that can't be handled by a String.split, he definitely should use an external library
1

Take a look here where I describe a regex you could use. You may need to tinker with it to deal with the extra spaces you have on either side of your commas.

Please remember that rolling your own CSV reader is likely to cause you trouble down the line. Please try very hard to use a ready-made one like OpenCSV mentioned elsewhere.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.