I set up a preferenceScreen to edit the settings in my application. I would like to insert an EditTextPreference that contains a Title like “set your name” and a summary containing the name entered.
Is that possible? thank you in advance!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Sure, here is a short example:
This requires that you display your preferences either from a
PreferenceActivityor from aPreferenceFragment, sincefindPreference()is a method of these classes. You most likely do that already.To change the summary every time the user changes the actual preference, use a
OnPreferenceChangeListenerand check if the relevant key changed in the callback.After it has changed, just edit the summary like above.