Java.lang.NumberFormatException:Invalid Double: "

Source: Internet
Author: User

the above is the error message :

First, the first error address: Converts a string to a double type only after the value of the text box has been changed. The code is correct. Analysis Reason: Then indicates that the time to receive is NULL, must not be converted to double.


then we find the second error address: A toast prompt when the variable <12, and empty the text box (set to null).

Analysis Reason : This suddenly dawned, before in the edittext as long as input 12 will appear in this article of the error (and did not follow the code logic will have toast prompt popup)

Now enter 13 and the bug disappears.



finally summarized : Because I in the text box condition, is the supporting use focus listens and the text change listener, the code first part is in the focus listens to judge the condition, controls the user input, after the code partial text changes the listener to carry on the value, the value conversion.

I can assume that the code logic is correct for the moment.

Focus Listener : When the input value is 12, the condition is not met (the toast should be popped but not), and then the text of the EditText is set to an empty string.

text Change listener : Using variable Beed to get the string value in EditText (because it is a null value), the error message in this article appears.


(I novice, internship January, more and more feel that learning to debug and see logcat information is really very important, expect to have more harvest. )

(The text is purely personal point of view, welcome to the big God old birds criticized, although the problem solved, but Toast did not pop up, I still do not understand)

Java.lang.NumberFormatException:Invalid Double: "

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.