Here I test if newValue is null, that means I clicked "Cancel", I don't want to update the summary.

onPreferenceChange is called when you click "cancel" or "ok" in the dialog, so dismiss is always called.