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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:52:28+00:00 2026-05-31T18:52:28+00:00

In my app, I use a PreferenceActivity framework to store persistent data. My intent

  • 0

In my app, I use a PreferenceActivity framework to store persistent data. My intent is to create multiple save files, all of which may be accessed by the Preferences, but only one at a time.

When is it better to use a private file generated by Context.openFileOutput() and when is it better to use SharedPreferences?

EDIT
My data exists solely in primitives.

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

    Normally developers use a preference file that is common to an entire app using getDefaultSharedPreferences.

    However, Android has a getSharedPreferences(String name, int mode) method in Context. You could use this to have multiple preference files, in your case – save files, by using unique names passed into the name parameter.

    Regarding volatility, you can force the preferences to save by getting an Editor via edit() and then calling commit().

    Make sure to note that the SharedPreferences will indeed be shared based on the name:

    Retrieve and hold the contents of the preferences file ‘name’, returning a SharedPreferences through which you can retrieve and modify its values. Only one instance of the SharedPreferences object is returned to any callers for the same name, meaning they will see each other’s edits as soon as they are made.

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

Sidebar

Related Questions

I'm doing it like this: app.use(express.session({ cookie:{domain:.+settings.c.SITE_DOMAIN}, secret:'abc', store: redis_store, })); When I log
With the following enabled: app.use(express.session({ store: sessionStore, secret: 'secret', key: 'express.sid'})); Whilst testing my
I'm trying to use the PreferenceActivity in a java app and I'm able to
Should a NHibernate desktop app use a SessionFactory and multiple sessions ? Does the
Is it possible to have multiple Shared Preferences per app? If you create a
if your app use this solution , do do you plan port the app
You can use App.config; but it only supports key/value pairs. You can use .Net
In my rails app I use the validation helpers in my active record objects
In our web-app we use PHP5.2.6 + PDO to connect to a SQL Server
In my web app I use several asmx (Web Services) from the same provider,

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.