Parse EditText after the user enters Enter

I have a pretty easy problem to solve but I can't see any tutorials on internet to help me. Because this problem is pretty basic I think I don't use the right keywords for my search.

My problem is that I parse an EditText with a method and use this method to feed the values of a graph:

public int getSetPoint(){
    int setPointRequest = Integer.parseInt(txtSetPoint.getText().toString());
    if (setPointRequest > 90 && setPointRequest < 120);
        return setPointRequest;
    // ...

I would like to parse the value only if setPointRequest() has the values between 91 and 119 and after the user press Enter on the keypad. When the user is prompted to enter a value only numbers are shown on the keypad already.

Currently all the values that the user inputs even if he doesn't hit Enter are registered on the graph.

Thanks for your help! Math

public int getSetPoint(){
  int setPointRequest = Integer.parseInt(txtSetPoint.getText().toString());
  if(setPointRequest>90 && setPointRequest<120) //notice the lack of ;
    return setPointRequest;

  return -1;

To handle an enter key:

txtSetPoint.setOnEditorActionListener ( new OnEditorActionListener() {
  public boolean onEditorAction(TextView v, int actionId, KeyEvent event)
    if (actionId == EditorInfo.IME_NULL)
    return true;

Your first issue is the semicolon right after the if. Remove that.

Second issue is that after you fix this issue, you will get a compile time error since you need a default return statement (that can be guaranteed to execute in case your if doesn't). I used -1, you can customize it to your needs. I'd also put the parsing in a try/catch just to be safe from any odd errors, but it's up to you.

In addition, the naming is bad, getSetPoint() is not immediately clear from the name, but the return type and lack of arguments do give a rough idea.