title: Toast message requiring user to fill in blank "EditText" fields
body: <p>I am trying to get a message to appear when a button is clicked to tell the user to fill in the blank field. Currently, if the field is blank, it crashes/force closes the app. I tried to do the following code and had zero success. Originally I didn't have the if/else in there, I just ran the calculator(); method and the following imm code.   </p>
  
  <p>Could someone point me into the right direction?</p>
  
  <pre><code>  public void onClick(View  v) 
    { 
       if ((EditText)findViewById(R.id.amount1)== null)
       {
            Context context = getApplicationContext();
            CharSequence text = "Enter a number";
            int duration = Toast.LENGTH_SHORT;
  
            Toast toast = Toast.makeText(context, text, duration);
            toast.show();
       }
       else
       {
        calculator();
        InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
       }
    }
  </code></pre>
  
  <p>Im pretty sure this is the bad code:</p>
  
  <pre><code>if ((EditText)findViewById(R.id.amount1)== null)
  </code></pre>
  
  <p>Just dont know how to word it the way I want.</p>