Lang.numberformatexception In Android
I have the following code which does nothing but reading some values from a DB in a background thread and using the values I draw a Line chart using a jar.For the line chart I use
Solution 1:
I'm not sure just by looking at this, but I can tell you, this is where Log.v is extremely handy. Put a Log.v(TAG,"\""+values[]+"\""), and you'll see exactly what's getting to that function. If it's anything other than a pure number, that'd be what's causing the exception to occur.
Solution 2:
Obviously the first element isn't a proper string containing a float.
So obviously the content of c.getString(3) must be wrong. Check that this is a string, and that this string contains strictly a float. Check for invalid characters, spaces, etc.
Solution 3:
Use try catch
block where you are parsing string into int
try{
// todo
}
catch( NumberFormatException ex ) {
}
Post a Comment for "Lang.numberformatexception In Android"