I can't for the life of me figure out what I'm doing wrong. I am trying to limit the user input to a integer. So that when I use the following code
int userNumber = Integer.parseInt(userGuess.getText().toString());
my app doesn't crash.
I figured out how to do it as follows in java, http://www.browxy.com/SavedCode/48384. The only issue I'm having is transposing this concept to my app. Android Studio is not recognizing the hasNextInt() when I use it.
First I use the findViewId method to obtain the view:
EditText userGuess = (EditText) findViewById(R.id.userGuess);
Then I tried to check whether the userGuess.getText().toString(); was an integer through the means of loops. And as I said android Studio does not recognize the hasNextInt();
And when looking through the stackOverflow one of the users said to avoid using the expection to solve this problem. Please Help!