Possible Duplicate:
String from EditText to float
In application I want to convert the entered string in edit box to the corresponding value like 233243664376347845.89
to corresponding float value. But it returns like IE10 after some number for example 23324366IE10
Please help me. My code is -
NumberFormat format = NumberFormat.getInstance(Locale.US); try { number = format.parse(e1.getText().toString()); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); }
The edit text length is greater then 20 digits,also i want to minus two edit text float values...
Converting the string to float. Float floatVal = Float. valueOf(str). floatValue();
We can convert a string to float in Python using float() function. It's a built-in function to convert an object to floating point number. Internally float() function calls specified object __float__() function.
Float c=Float. parseFloat(a); Float d= Float. parseFloat(b);
String s = e1.getText().toString(); Float f= Float.parseFloat(s);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With