[android-developers] Converting data error
I have returned, once again, in seek of help. Problem this time is using the Scanner class,
private void loadModel(String modelName) {try {InputStream is = getApplicationContext().getAssets().open("models/" + modelName);Scanner scanner = new Scanner(is);System.out.println("File " + modelName + " found");scanner.useLocale(Locale.US);while (scanner.hasNext()) {String line = scanner.next();if (line.startsWith("v")) {String string = new String(scanner.next() + " "+ scanner.next() + " " + scanner.next());System.out.println(string);}}scanner.close();is.close();} catch (FileNotFoundException e) {System.out.println("File not found");} catch (IOException e) {System.out.println("IOEXCEPTION");} catch (IllegalStateException e) {System.out.println("Illegal state");} catch (NoSuchElementException e) {System.out.println("No such element");}}}
It correctly prints the vertices (as in x,y,z) but in string format. I've tried converting it to floats, doubles, longs, integers, etc. With no luck. I have no idea why it simply won't work. I get the NoSuchElement exception. Would post more info but it's getting late.
-- You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home