In my J2ME application, I got data from .csv file and display all data from file on device. But according to my requirement, I want to display only single cell data on device.So,how can I fetch single cell record from .csv file and display it on device?
“Update After Comment“
InputStream is = getClass().getResourceAsStream("/" + "csvsample.csv");
StringBuffer sb = new StringBuffer();
try {
int chars;
while ((chars = is.read()) != -1) {
sb.append((char) chars);
return sb.toString();
} catch (Exception e) {
System.out.println("Exception Occurance::" + e);
}
return sb.toString();
}
First you must read one line at a time. For this you can use below method:
Then you need to split the line content based on
,separator, for example, like at this other question How do I split strings in J2ME?.