Ajout de EditText à une boîte de dialogue d'alerte.

J'ai le code suivant qui créent de la boîte de dialogue d'alerte et j'ai ajouté deux modifier le texte, mais une fois que je lance l'application, les valeurs de la EditText de ne pas être récupéré et mon appli crash avec NullPointerException:

le code est:

AlertDialog.Builder alert = new AlertDialog.Builder(this);
        LayoutInflater inflater=this.getLayoutInflater();
        final EditText usernameInput=(EditText)findViewById(R.id.dialogusername);
        final EditText passwordInput=(EditText)findViewById(R.id.dialogpassword);   
        alert.setView(inflater.inflate(R.layout.dialog,null));
        alert.setTitle("Enter Password");
        alert.setMessage("Enter password to remove the app:");
        alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
            //provide user with caution before uninstalling
            //also here should be added a AsyncTask that going to read the password and once its checked the password is correct the app will be removed
            value1=usernameInput.getText().toString();
            value2=passwordInput.getText().toString();
            if(value1.equals(null)&&value2.equals(null))
            {Toast.makeText(context, "Enter username and password", Toast.LENGTH_SHORT).show();}
         }
        });
        });
        alert.show();

source d'informationauteur Husam A. Al-ahmadi