title: Android - Dialog Box - Leave dialog open if user inputs wrong password
body: <p>I have a dialog box for the user to input an unlock code. I want to keep the box open if they input the wrong code so they have a chance to fix it.</p>
  
  <pre><code>AlertDialog.Builder alert = new AlertDialog.Builder(this);
  
      alert.setTitle("Unlock Code");
      alert.setMessage("Please enter the unlock code.");
  
  
      final EditText input = new EditText(this);
      alert.setView(input);
  
      alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
      public void onClick(DialogInterface dialog, int whichButton) {
        String value = input.getText().toString();
       if(codeUnlock.checkCode(value)){ // checks the code that was put in
           Toast.makeText(MainActivity.this, "Thank you for purchasing.", Toast.LENGTH_LONG).show();
           yearPurchased = currentYear;
           checkForUpdate(false);
  
       }else{
           Toast.makeText(MainActivity.this, "Incorrect code.", Toast.LENGTH_LONG).show();
  
  
       }
  
  
        }
      });
  
      alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
  
        }
      });
  
      alert.show();
  </code></pre>
  
  <p>basically, if checkCode is false i want to jsut display the toast but not close the window.</p>
  
  <p>any suggestions?</p>
  
  <p>Thank you.</p>