title: Validate edittext in PreferenceFragment
body: <p>I have an EditTextPreference for the user to enter a Bluetooth MAC address in my preferences.xml file.  I am using android:digits to limit input to valid characters, but that will not prevent someone from adding too little or too many characters, double colons, etc.  If they do these things, the app crashes with an invalid MAC address exception.  Is there a way to do this programmatically?</p>
  
  
  
  <pre><code>&lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
  
      &lt;PreferenceCategory android:title="Bluetooth Settings"&gt;
  
          &lt;EditTextPreference
              android:key="prefMacAddress"
              android:title="MAC Address"
              android:lines="1"
              android:maxLines="1"
              android:summary="Enter MAC Address of the Module"
              android:dialogTitle="MAC Address"
              android:dialogMessage="Enter MAC Address of the Module"   
              android:defaultValue="20:13:07:26:24:32"
              android:digits="0123456789abcdef:"/&gt;
  
      &lt;/PreferenceCategory&gt;
  
  &lt;/PreferenceScreen&gt;
  </code></pre>