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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T17:59:05+00:00 2026-05-29T17:59:05+00:00

I am writing a date to SharedPreferences when ever my app retrieves the latest

  • 0

I am writing a date to SharedPreferences when ever my app retrieves the latest data from a feed. I now need to read that value however I cannot find much information on concurrency when reading/writing to SharedPreferences.

Would I have to use the synchronized keyword in my methods to prevent/lower the chances of causing a force close? Or have the folks at Google made SharedPreferences in a way that I shouldn’t worry about this?

For the record I do not think there is much likelihood of a collision due to the infrequent read and write operations although I would not like to assume that everything will just “work”.

  • 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-29T17:59:06+00:00Added an answer on May 29, 2026 at 5:59 pm

    Use the flag MODE_MULTI_PROCESS when opening the SharedPreferences. This was the legacy (but undocumented) behavior in and before Gingerbread (Android 2.3) and this flag is implied when targeting such releases. For applications targeting SDK versions greater than Android 2.3, this flag must be explicitly set if desired.

    This constant was deprecated in API level 23.
    MODE_MULTI_PROCESS does not work reliably in some versions of Android, and furthermore does not provide any mechanism for reconciling concurrent modifications across processes. Applications should not attempt to use it. Instead, they should use an explicit cross-process data management approach such as ContentProvider.

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

Sidebar

Related Questions

I am writing a C++ app that has to parse a date/time string and
I'm writing a Perl script that does date operations that need to take holidays
I was writing to some code where I needed to read the date value
I'm writing a small android app that lets the user pick a date and
I'm writing a date/time value to an XML file by reading the date from
I'm writing a JSP that sometimes needs to format a Java Date that comes
I'm writing a bat script and I have to save the date from a
I am writing a date in xml file & then reading a date from
ok, I'm writing a little code snippet to get the ISO date-format value for
Writing an iPhone app in Objective-C, I have a date in string form (in

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.