In a Android application I want to use Scanner class to read a list of floats from a text file (it\'s a list of vertex coordinates for OpenGL). Exact code is:
Sc
Very Insightful post. Normally when I worked with Java thought Scanner
is fastest on PC. The same when I try to use it in AsyncTask
on Android, its WORST.
I think Android must come up with alternative to scanner. I was using scanner.nextFloat();
& scanner.nextDouble();
& scanner.nextInt();
all together which made my life sick. After I did my tracing of my app, found that the culprit was sitting hidden.
I did change to Float.parseFloat(scanner.next());
similarly Double.parseDouble(scanner.next());
& Integer.parseInt(scanner.next());
, which certainly made my app quite fast I must agree, may be 60% faster.
If anyone have experienced the same, please post here. And I'm too looking out at alternative to Scanner
API, any one have bright ideas can come forward and post here on reading file formats.