title: Android: Toast and Edit.GetText
body: <p>I'm trying to find out if the user put something in the edit text.
  It works but when I don't enter anything it wont show; "Please enter your name". 
  Also tried null instead of "" or " " didn't work.</p>
  
  <p>Any help?</p>
  
  <pre><code>    package com.grumbledorf.Hellotraining;
  
  import android.app.Activity;
  import android.content.Context;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.Toast;
  
  public class main extends Activity {
  
      EditText etName;
      Button btMake;
  
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          etName = (EditText) findViewById(R.id.etName);
          btMake = (Button) findViewById(R.id.btPress);
          final Context context = getApplicationContext();
          final int duration = Toast.LENGTH_SHORT;
  
          btMake.setOnClickListener(new View.OnClickListener() {
  
              public void onClick(View v) {
                  if(etName.getText().toString() == " "){
  
                      Toast toast = Toast.makeText(context, "Please enter your name", duration);
                      toast.show();
                  }else{
                      String Henk = etName.getText().toString();
                      Toast toast = Toast.makeText(context, "Welcome, " +  Henk, duration);
                      toast.show();
                  }
  
              }
          });
  
  
  
      }
  }
  </code></pre>