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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:47:15+00:00 2026-06-12T13:47:15+00:00

How do I update my PreferenceActivity? I’ve saved in the SharedPreferences the value of

  • 0

How do I update my PreferenceActivity?

I’ve saved in the SharedPreferences the value of my CheckBox in an activity (in that case, true). And even if I go to other activities I can see that it’s true. But, when I go to my PreferenceActivity, the checkbox is not checked, it’s false. So what I want to know is, how do I load my SharedPreferences in my PreferenceActivity, and how do I update the CheckBox (load the value, and if it’s true, set the CheckBox as checked).

Should I load it like this?

Shared Preferences SP = getSharedPreferences(DATA, MODE_PRIVATE);
fw = SP.getBoolean("fw", false);

But, how do I set the CheckBox true or false since I can’t use findViewById?

EDIT:

Activity where I save the CheckBox value:

Editor edit = SP.edit();
edit.putBoolean("fw", fwbt.isChecked());
edit.commit();

My preference xml file:

<CheckBoxPreference
    android:title="CheckBox FW"
    android:key="fw"
    android:summary="Estado do CheckBox" />

My preference Activity:

public class Prefs extends PreferenceActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.prefs);
        //Don't know what to do here...
    }
}
  • 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-06-12T13:47:16+00:00Added an answer on June 12, 2026 at 1:47 pm

    I can’t find a solution, so I gave up. I’ve just created created a custom Preferences, it’s way easier.

    Anyway, I’ll keep looking for a solution for this later.

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

Sidebar

Related Questions

UPDATE: Thanks for the answers! I can't seem to figure it out, even with
UPDATE UPI_ATTRIBUTE SET SITE_INC ='0' WHERE USER_PROFILING_NAME IN ('CAR_IMPLICIT','CAR_EXPLICIT') Above is my query that
UPDATE 6/21/12 I have a form in rails that is working similar to an
I am calling a PreferenceActivity from another activity and then updating the application state
I'm using a custom subclass of SharedPreferences to encrypt my saved settings in the
I have pretty unassuming preferences screen based on PreferenceActivity . (You can see it
Update: Now that it's 2016 I'd use PowerShell for this unless there's a really
UPDATE - A comprehensive comparison, updated as of February 2015, can be found here:
My activity is below import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
i created application in that it will call preference from main activity based on

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.