1 int guessValue;
2 //Try-Catch to Catch any Kind of Error from editText
3 try {
4 guessValue = Integer.parseInt(editText.getText().toString());
5 }catch (Exception e)
6 {
7 Toast.makeText(this,"Please Enter a Valid Number",Toast.LENGTH_LONG).show();
8 return;
9 }