I created a DialogFragment.
The Dialog got a EditText and I call it from the dialog xml.
But there is the error: Attempt to invoke virtual method 'android.text.Editable android.widget.EditText.getText()' on a null object reference

New in this code:

```
    AlertDialog alertDialog;
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

```

and

```
final EditText editText = (EditText) alertDialog.findViewById(R.id.editTextPasswordDeveloper);

```

My Code:

```
public class DeveloperLoginDialogFragment extends DialogFragment {

EditText editText;

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    final LayoutInflater inflaterDialog = getActivity().getLayoutInflater();

    AlertDialog alertDialog;
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    alertDialog = builder.create();

   // final AlertDialog alertDialog = new AlertDialog.Builder(getActivity());
    builder.setCancelable(false);
    builder.setView(inflaterDialog.inflate(R.layout.alertdialog_developer, null));
    final EditText editText = (EditText) alertDialog.findViewById(R.id.editTextPasswordDeveloper);
    builder.setTitle("Entwickler-Login");
    builder.setMessage("Um dich als Entwickler zu verifizieren, gib den Entwickler-Code bitte unten ein.");
    builder.setPositiveButton("Verifizieren", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            if(editText.getText().toString().equals("7846")) {
                dialog.dismiss();
                Toast.makeText(getActivity().getApplicationContext(),"Erfolgreich verifiziert!", Toast.LENGTH_LONG).show();
            }
        }
    });
    builder.setNegativeButton("Abbrechen", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            Intent intent = new Intent(getActivity(), MainActivity.class);
            startActivity(intent);
        }
    });
    return builder.create();
}

```

}