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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:36:46+00:00 2026-05-25T23:36:46+00:00

I have a Preferences Screen which has some prefs that are interconnected. Which means,

  • 0

I have a Preferences Screen which has some prefs that are interconnected. Which means, if I have pref x and y, I sometimes need y to change to something when x changes.

What I’m doing at the moment is listening to prefs change event, and do this:

SharedPreferences.Editor editor = prefs.edit();
editor.putString("y_pref", "somevalue");
editor.commit();

The problem is, that to actually see the change I have to first close the prefs screen and then open it again, only that way will I see the newly set prefs.

Is there a way to change the prefs so that the change is visible right away, without the need to reload the prefs screen?

  • 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-25T23:36:47+00:00Added an answer on May 25, 2026 at 11:36 pm

    Try to call the setter of the preference itself instead updating it on your own:

    E.g. EditTextPreference.setText(). So the preference itself updates it’s own value too. If you do the update on your own the preference will not fetch the new value because it doesn’t even know that the persisted value has changed.

    If you have a PreferenceFragment, you can get the preference with PreferenceFragment.findPreference().

    If you have a PreferenceActivity, you can get the preference with PreferenceActivity.findPreference().

    You call that with the preference key you assigned in your settings XML file and you get an instance of the corresponding preference. Then you cast it to an CheckBoxPreference, EditTextPreference, etc (the type you set in your XML file).

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

Sidebar

Related Questions

I have a ListView that has some minor visual preferences that are set in
I have preferences page. It has field 'Show info screen' (as checkbox). I have
I have some questions about the registry. We have Preferences p = Preferences.userRoot(); If
I have a preferences panel in my application in which I have a NSColorWell
I would like some of my preferences to have icons, like the Settings app.
I have other pages within my app preferences which are stored as separate files
I have some table: table ASK with idask table PREFERENCES with idpref , fk_idask
I have two Activities, both have an inner class SurfaceView, which has an inner
I have workspace inside of Eclipse which has 2 projects in it. I want
I have a container which switches its main content between several screen-sized panes. I'm

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.