'What to do when user inputs a number greater than max int?
int chirps = Integer.parseInt( et_Chirps.getText().toString().trim() );
et_Chirps is and editText containing a number.
If a user enters a number greater than max int the program crashes.
How to resolve this?
Solution 1:[1]
You can limit length of input text by adding
android:maxLength="9"
Or you can change int to long to support higher range
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Dreamer |
