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 3969162
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:55:50+00:00 2026-05-20T03:55:50+00:00

I have a PreferenceActivity with a bunch of (Sub)PreferenceScreens. Each such (Sub)PreferenceScreen represents an

  • 0

I have a PreferenceActivity with a bunch of (Sub)PreferenceScreens. Each such (Sub)PreferenceScreen represents an account and has the account-username as its title.

PreferenceScreen root = mgr.createPreferenceScreen(this);
for (MyAccountClass account : myAccounts) {
    final PreferenceScreen accScreen = mgr.createPreferenceScreen(this);

    accScreen.setTitle(account.getUsername());

    // add Preferences to the accScreen
    // (for instance a "change username"-preference)
    ...

    root.add(accScreen);
}

As the user enters sub-PreferenceScreen, and edits the account user-name, I want the outer PreferenceScreen to update it’s PreferenceScreen-title for the account in question.

I’ve tried to add…

usernamePref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
    public boolean onPreferenceChange(Preference preference, Object newValue) {
        accScreen.setTitle(newValue.toString());
        return true;
    }
});

…but the accScreen.setTitle does not seem to take effect on the outer PreferenceScreen. I’ve note that calling onContentChanged(); actually makes it work, but I realize that this is probably not the preferred way of doing it.

I suspect I should call postInvalidate() on some view somewhere, but I really can’t figure out on what view and when to do it.

PreferenceScreen android:summary update ! may be experiening the same problem as me.

Any help appreciated.

  • 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-20T03:55:51+00:00Added an answer on May 20, 2026 at 3:55 am

    I found a solution to this. I have a hierarchy like this, each of these is a PreferenceScreen:

    main settings
      -> users list
        -> user1 settings
        -> user2 settings
        ...
    

    In the users list, title of the sub-screen is dependent on the user settings. Now when I create the user list, I store the list adapter to a variable in my PreferenceActivity.

     PreferenceScreen usersListScreen = ...
     userScreenListAdapter = (BaseAdapter)usersListScreen.getRootAdapter();
    

    Now when userX-settings are edited, I set the titles in the usersListScreen and after that call:

    userScreenListAdapter.notifyDataSetChanged();
    

    which updates the list UI and the changes are visible.

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

Sidebar

Related Questions

I have a PreferencesActivity with a nested PreferenceScreen, so the PreferenceScreen has its own
I have a PreferenceActivity that gets its data from a web service(Call forward Numbers,
I have created a PreferenceActivity based on xml for PreferenceScreen. In the xml you
I have the same problem like this question: Custom title bar in PreferenceActivity? After
I have a TabActivity where each tab has ActivityGroup. On the home ActivityChild of
I have a PreferenceActivity that loads its preferences from an XML file which looks
I have need for AutoCompliteTextView in PreferenceActivity so I extended DialogPreference. My auto-complite is
I have an PreferenceActivity where I would like to add Preferences dynamically. On a
I have used PreferenceActivity to have preference in my android application. I want one
I have an application that uses the new features of honeycomb for the PreferenceActivity.

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.