title: Android check if multiple strings are not empty
body: <p>I have a form and I put the forms data in an intent and then start a new activity and send the data with the intent, but I wanna do a check if the strings are empty I should display and error message. If the strings are not empty the activity can be started.</p>
  
  <p>I've tried the following code but it doesn't seem to be working. If the field is empty it just starts the other activity
  (I've tried with only 1 field for now, because I don't know how to to it for multiple fields)</p>
  
  <pre><code>    //getting the field values
      String firstname = editTextFirstname.getText().toString();
      String lastname = editTextLastname.getText().toString();
      String amount = editTextBedrag.getText().toString();
      String timespan = spinnerPeriode.getSelectedItem().toString();
      String iban = editTextIBAN.getText().toString();
  
      if(firstname != null) {
          //putting data in the intent
          intent.putExtra(FIRSTNAME, firstname);
          intent.putExtra(LASTNAME, lastname);
          intent.putExtra(AMOUNT, amount);
          intent.putExtra(TIMESPAN, timespan);
          intent.putExtra(IBAN, iban);
  
          startActivity(intent);
      }else{
          Toast.makeText(MainActivity.this, "Oops, you forgot to fill in some fields!", Toast.LENGTH_SHORT).show();
      }
  </code></pre>