title: ListPreference updates its value only when entry is chosen for the second time
body: <p>When the language in <code>ListPreference</code> is changed, <code>setLanguage()</code> method from <a href="https://stackoverflow.com/a/2900144/11714703">this answer</a> in <code>onSharedPreferenceChanged()</code> method in my <code>SettingsFragment</code> class is called.</p>
  
  <pre><code>String defaultCode = getActivity().getString(R.string.string_english_code);
  String langCode = sharedPreferences.getString(PREF_LANGUAGE, defaultCode);
  setLanguage(getActivity(), langCode);
  ((SettingsActivity) getActivity()).restartFragment();
  </code></pre>
  
  <p>Changing a language works fine, but when <code>setSummary()</code> is called on the <code>ListPreference</code> object in <code>onCreate()</code> it changes only when the necessary language is chosen for the second time.</p>
  
  <pre><code>ListPreference langPreference = (ListPreference) findPreference(PREF_LANGUAGE);
  langPreference.setSummary(langPreference.getEntry());
  </code></pre>
  
  <p>P.S. If <code>setLanguage()</code> is not called, summary updates as it should be.</p>