I am trying to change the positiveButtonText
of Dialog
in the `EditTextPreference. I have tried the following with no success :
// The reference to the preference in the view heirarchy
mUrlPreference = (EditTextPreference) getPreferenceScreen().findPreference(pref);
// Add a textwatcher
mUrlPreference.getEditText().addTextChangedListener(prefWatcher);
The prefWatcher
is the following :
private TextWatcher prefWatcher = new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
}
@Override
public void afterTextChanged(Editable s) {
Log.i(TAG_LOG, "Updating the positive button text");
mUrlPreference.setPositiveButtonText("Download");
}
};
When I change the text in the EditText, the Log gets printed, but the Positive button text is not changing. Is there anything I'm missing here? My initial thought was that I would have to refresh the dialog's view hierarchy, but I don't see any methods in the API to do it. Any ideas as to what I'm missing here?