title: How to setOnClickListener() to OK button of an EditTextPreference Dialog?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/7527894/how-to-call-the-ok-button-in-the-edittextpreference">how to call the ok button in the EditTextPreference</a>  </p>
  </blockquote>
  
  
  
  <p>I want to validate the Inputs (enter 6 digits) of an EditTextPreference dialog box.</p>
  
  <p>This is how my (relevant) preferences.xml snippet looks like :</p>
  
  <pre><code>            &lt;!--EditTextPreference--&gt;
              &lt;com.app.preferences.UpdatePincodePreference
                  android:key="PIN_CODE_PREFERENCE"
                  android:title="@string/pincode_preference_title" 
                  android:summary="@string/pincode_preference_summary"
                  android:dialogTitle="@string/pincode_preference_dialog_title"
                  android:dialogMessage="@string/pincode_preference_dialog_message" 
                  android:inputType="number"
              /&gt;
  </code></pre>
  
  <p>How do I test that the user has not entered less or more than 6 digits in the EditText of the preference dialog?</p>
  
  <p>Basically I need to set an onClickListener() on the OK button, but how to I get a hold of the OK button which I did not define. Its the default view of an EditTextPreference, and so is the Cancel button.</p>
  
  <p>The question is exactly the same as "<a href="https://stackoverflow.com/questions/7527894/how-to-call-the-ok-button-in-the-edittextpreference">how to call the ok button in the EditTextPreference</a>" but the links provided in the accepted solution are broken now.</p>