title: custom dialog exception
body: <p>ihave been used the custom dialog and an <code>EditText</code> in it , and i validate the <code>EditText</code>  by displaying error message when the user click the <strong>ok</strong> button without entering his/here name , but when i run it and click the ok button either with or not entering a name  an exception 
  Occur why is that ? please help me..</p>
  
  <p>this is my code</p>
  
  <pre><code>final Dialog nameDialog =new Dialog(ProfileView.this);
              nameDialog.setContentView(R.layout.namedialog);
              nameDialog.setTitle("please enter your name");
              name =(EditText)nameDialog.findViewById(R.id.nameETDialog);
              Button okButton = (Button) nameDialog.findViewById(R.id.ok);
  
              okButton.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {
                      //validate the name 
                      if( name.getText().toString()== null)     
                         name.setError( " your name is requiered" );
  
  
                      else
                      { 
                        EditText nametext=(EditText)findViewById(R.id.name_text);
                        nametext.setText(name.getText().toString());
                        Toast.makeText(getBaseContext(),"your name has been entered ", Toast.LENGTH_SHORT).show();
                  }
                      }
  
      });
              Button cancelButton = (Button) nameDialog.findViewById(R.id.cancel);
              cancelButton.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {
                      nameDialog.dismiss();
                  }
  
  
              });
  
              nameDialog.show();
  
  
  }
      });
  
  }
  </code></pre>
  
  <p>}</p>