title: The alert dialog must not dismiss until user input text in editext is valid
body: <p>I am making an alert dialog with edit text. I want that it will remain on screen until user input his email in it. How can I do that?? My code is as below:    </p>
  
  <pre><code>final AlertDialog.Builder alert= new AlertDialog.Builder(this);
      alert.setMessage("Enter Email:");
      final EditText userid = new EditText(this);
      alert.setView(userid);
      userid.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
      alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
  
          public void onClick(DialogInterface dialog, int which) {
              if (userid.getText().toString().length()&gt;0){
                  userId = userid.getText().toString();               
                  result();
              }else{
  
                  Toast.makeText(getApplicationContext(), "Enter your email for future reference.", Toast.LENGTH_SHORT).show();
              }
          }
      });
      alert.show();
  </code></pre>
  
  <p>by clicking on any button the dialog dismisses. Please do tell how to retain the dailog on screen till i need it.Thanx in advance...</p>