android - Validate edittext in PreferenceFragment -


I have an EditTextPreference to enter a Bluetooth MAC address in my preferences XML file. I am using Android: points to restrict valid characters to input, but it will not prevent anyone from adding too few or too many letters, double colon etc. If they do this, then the app is a way to do this program with an illegal MAC address exception?

  & lt; Priority xmlns: android = "http://schemas.android.com/apk/res/android" & gt; & Lt; PreferenceCategory Android: Title = "Bluetooth Settings" & gt; Android: Android: Android: Android: Android: Android: Android: Android: Android: Android: Android: Android: Android: Android: Android: Enter Module's MAC Address. Android: DialogTital = "MAC Address: Android: Dialog Message =" Enter MAC Address of Module "Android: defaultValue =" 20: 13: 07: 26: 24: 32 "Android: Issue =" 0123456789abcdef: "/ & gt; & Lt; / PreferenceCategory & gt; & lt; / PreferenceScreen & gt;  

Use regular expressions for input in the editing text. Here's a nice tutorial:


Comments