Can't get String from EditText in Custom AlertDialog

view full story

http://stackoverflow.com – I am in an impasse regarding getting the text from a custom AlertDialog. I get an error "NullPointerException". I have moved defining the variable containing the EditText in the AlertDialog, but I get the same error. My layout item in it's XML "pin.xml" <EditText android:id="@+id/insert_pin" android:layout_width="90dp" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:ems="10" android:gravity="center" android:inputType="numberPassword" android:maxLength="4" /> The AlertDialog (HowTos)