Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6136501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:36:38+00:00 2026-05-23T17:36:38+00:00

I am able to show EditTextPreference with default summary. Now i want to update

  • 0

I am able to show EditTextPreference with default summary. Now i want to update it when i enter new value in Edit Text box and click ok then it should be upadate the value of summary. But i am unable to do that. My code is below please update in my code which required.

public class Prefs extends PreferenceActivity {

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.prefs);

    final EditTextPreference pref = (EditTextPreference)findPreference("username");
    pref.setSummary(pref.getText());
    pref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
      public boolean onPreferenceChange(Preference preference, Object newValue) {
        final EditTextPreference pref = (EditTextPreference)findPreference("username");

        pref.setSummary(pref.getText());

        return true;
      }
    });
  }
}

xml file is

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
  <EditTextPreference 
    android:title="User Name"
    android:key="username" 
    android:summary="Please provide user name" />
  <EditTextPreference 
    android:title="Password" 
    android:password="true"
    android:key="password" 
    android:summary="Please enter your password" />
</PreferenceScreen>

actually my code update previous enter value as summary text. How to show text as summary when I click ok button. Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:36:38+00:00Added an answer on May 23, 2026 at 5:36 pm

    Your preference activity doesn’t appear to be implementing OnSharedPreferenceChangeListener

    You may want to read over the excellent answer to the question:
    How do I display the current value of an Android Preference in the Preference summary?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to be able to show in a propertygrid a dropdownlist that show
I want to be able to show a dialog on outbound calls. The dialog
I want to be able to show if an Image has been associated with
I have a popup confirm box which i am able to show like below.
Here's what I'm trying to accomplish: I want to be able to show dmesg
I want to be able to show minutes and seconds in a textbox. The
I created a custom password box user control which is able to show and
I want to be able to capture the exception that is thrown when a
I want to be able to do: For Each thing In things End For
I want to be able to play sound files in my program. Where should

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.