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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:12:09+00:00 2026-05-26T16:12:09+00:00

Based on the following code, can you tell me how to refresh the PreferenceActivity

  • 0

Based on the following code, can you tell me how to refresh the PreferenceActivity window to show changes in the settings immediately? For example: the user taps the master chime toggle checkbox to true (ticked), I would like the user to immediately see the other settings such as the ChimeOn15Past checkbox also be be true (ticked)

SharedPreferences.Editor prefEditor = clockSettings.edit(); // Allow the settings to be changed.

if (booleanMasterChimeToggle == true) {
    prefEditor.putBoolean("ChimeOnTheHour", true);
    prefEditor.putBoolean("ChimeOn15Past", true);
    prefEditor.putBoolean("ChimeOn30Past", true);
    prefEditor.putBoolean("ChimeOn45Past", true);

    strNotifyMessage = "Full chiming has now been set.";

} else {
    prefEditor.putBoolean("ChimeOnTheHour", false);
    prefEditor.putBoolean("ChimeOn15Past", false);
    prefEditor.putBoolean("ChimeOn30Past", false);
    prefEditor.putBoolean("ChimeOn45Past", false);

    strNotifyMessage = "Full chiming has now been disabled.";
}
  • 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-26T16:12:10+00:00Added an answer on May 26, 2026 at 4:12 pm

    Nikolay’s answer is correct. I just want to add some code here to illustrate his point more clearly.

    private CheckBoxPreference mOn15Past;
    private CheckBoxPreference mOn30Past;
    private CheckBoxPreference mOn45Past;
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    
        // Load the preferences from an XML resource
        addPreferencesFromResource(R.xml.preferences);
    
        mOn15Past = (CheckBoxPreference) findPreference("ChimeOn15Past");
        mOn30Past = (CheckBoxPreference) findPreference("ChimeOn30Past");
        mOn45Past = (CheckBoxPreference) findPreference("ChimeOn45Past");
    
        final Preference chimeMaster = findPreference("ChimeMaster");
        chimeMaster.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
            @Override
            public boolean onPreferenceChange(Preference preference, Object newVal) {
                final boolean value = (Boolean) newVal;
                mOn15Past.setChecked(value);
                mOn30Past.setChecked(value);
                mOn45Past.setChecked(value);
                return true;
            }
    
        });
    }
    

    In short, PreferenceActivity is not designed to refresh its values from the persistent storage once it is started. Instead of using SharedPreferences.Editor to modify and commit additional changes like you did in your code, it is better to make the changes into the local PreferenceManager object which will be committed by the PreferenceActivity in its normal lifecycle.

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

Sidebar

Related Questions

Can someone explain the following code snippet for me? // Bind base object so
I am currently running the following code based on Chapter 12.5 of the Python
My question is concerning SQL connection status, load, etc. based on the following code:
In the following code, the stack-based variable 'ex' is thrown and caught in a
I have the following code in WCF service to throw a custom fault based
Gday All, The following code displays a div based on the option that has
I have the following HTML code based on a tab menu format, i.e: <div
Consider the following base code: (function($) { $.fn.myPlugin = function(settings) { return this.each(function() {
Please can someone tell me the technique that would be used, for the following
The following code is visual basic, .NET, ASP... all of the above? Can anybody

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.