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

  • Home
  • SEARCH
  • 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 6980399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:00:45+00:00 2026-05-27T18:00:45+00:00

I have implemented some app preferences for my app. For strings they work great

  • 0

I have implemented some app preferences for my app. For strings they work great but not for boolean values. E.g.

public class MdSharedPrefs {
    public final static String PREFS_NAME = "prefs";

    public static boolean getSSFlag(Context context) {
        SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, 0);

        return prefs.getBoolean(context.getString(R.string.pref_key_ss), false);
    }

    public static void setSSFlag(Context context, boolean newValue) {
        SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, 0);
        Editor prefsEditor = prefs.edit();
        prefsEditor.putBoolean(context.getString(R.string.pref_key_ss),
                newValue);
        prefsEditor.commit();
    }

}

And this requires

<string name="pref_key_ss"></string>

in strings.xml. When I remove this line the project wont compile. But when I leave it this boolean pref does not work. When I click it and go back to main screen and then go back to prefs the value is not checked.

However for strings it works fine.

Any ideas whats wrong?

  • 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-27T18:00:46+00:00Added an answer on May 27, 2026 at 6:00 pm

    in my application i am using like this it’s working fine

    declaration

     private static final String SUNDAY_ON = "sunday_selected";
    

    getting

     state = prefs.getBoolean(SUNDAY_ON, false);
    

    storing like this

     editor.putBoolean(SUNDAY_ON, value);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have already implemented some AJAX pagination in my Rails app by using the
I am working to implement some simple preferences to an app I have and
I have been asked to implement some email address validation on a web app
What are some of the ways you have implemented models in the Zend Framework?
I have implemented a simple linux shell in c. Now, I am adding some
I have some .NET remoting code where a factory method, implemented in some server
I have some REST web services implemented in WCF. I wish to make these
interfaces provide a useful abstraction capability. One can have a class Foo implement some
I've implemented some extension methods and put those in separate Class Library project. Imagine
I have a rails app which requires users to verify that they own a

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.