You can extend EditTextPreference to get control over 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) {
// add Handler here
}
super.onClick(dialog, which);
}
}
In the Xml instead of <EditTextPreference/>
reference it like this:
<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."/>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…