title: How do I display the current value of an Android Preference in the Preference summary?
body: <p>This must come up very often.</p>
  
  <p>When the user is editing preferences in an Android app, I'd like them to be able to see the currently set value of the preference in the <code>Preference</code> summary.</p>
  
  <p>Example: if I have a Preference setting for "Discard old messages" that specifies the number of days after which messages need to be cleaned up. In the <code>PreferenceActivity</code> I'd like the user to see:</p>
  
  <p><em>"Discard old messages"</em> &lt;- title</p>
  
  <p><em>"Clean up messages after <strong>x</strong> days"</em> &lt;- <a href="http://code.google.com/android/reference/android/preference/Preference.html#setSummary(java.lang.CharSequence)" rel="noreferrer">summary</a> where <strong>x</strong> is the current Preference value </p>
  
  <p>Extra credit: make this reusable, so I can easily apply it to all my preferences regardless of their type (so that it work with EditTextPreference, ListPreference etc. with minimal amount of coding).</p>