I keep developing my very first android app. It has several EditText views, which the user is supposed to fill in in order to get a result. If no data is entered, then when I parse data from an empty EditText into an int for subsequent calculation, I get the NumberFormatException. What I want to do is if the user forgot to enter data in some EditText, I need to get the ID of that view and change it's hint color into red. So is there a way for an exception handler to grab the ID of the view, which has caused the exception? Thank You!
I think you may be need a TextInputEditText? or you just need to judge whether the content of EditText is empty. If it is empty, set up an error prompt?
1.4m articles
1.4m replys
5 comments
57.0k users