onSharedPreferenceChanged
is called because of the inbuilt callback registered on the sharedpreference
, so unless you change the key associated with dialogPreference you are not going to get the onSharedPreferenceChanged
callback.
So what you could do is everytime dialog is closed, you could change the value in key. Something like below
text = getPersistedString("1")
if(text.length() > 10)
text = "1";
persistString(text+"1");
Make sure your dialogPreference has a key and android:persistent as true in xml