You can extend EditTextPreference to gain control of the click handler.
package myPackage; public class CustomEditTextPreference extends EditTextPreference { public CustomEditTextPreference(Context context) { super(context); } public CustomEditTextPreference(Context context, AttributeSet attrs) { super(context, attrs); } public CustomEditTextPreference(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override public void onClick(DialogInterface dialog, int which) { if (which == DialogInterface.BUTTON_POSITIVE) {
In Xml, instead of <EditTextPreference/> do the following:
<myPackage.CustomEditTextPreference android:dialogTitle="Registration Key" android:key="challengeKey" android:title="Registration Key" android:summary="Click here to enter the registration key you received by email."/>
source share