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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:02:18+00:00 2026-06-09T15:02:18+00:00

I have a DialogView which stores settings in shared preferences. It is located in

  • 0

I have a DialogView which stores settings in shared preferences. It is located in package A and i have another activity which is located in package B, which should be able to read these preferences.

So I created a wrapper class, which takes context and shared preference name and retrive these settings. When shared preferences are set at the first time everything works great, but when I change it, I got the same result, which was set at first time.

Problem is I save preference in one process and need to be able to read them in another.

So it seems like Context has changed and I am not able to retrive new context. What should I do to get up to-date shared preference?

Thank you on advance.

Please take a look at my wrapper class

public class PhotoAppWidgetSettingsProxy extends Proxy {

    private final static String PREFERENCES_NAME = PhotoAppWidgetSettingsProxy.class.getName();
    private final static int PREFERENCES_MODE = Context.MODE_PRIVATE;

    private Context mCtx = null;
    private SharedPreferences pref = null;
    private SharedPreferences.Editor editor = null;


    public PhotoAppWidgetSettingsProxy(String name, Context context) {
        super(name, context);       
        mCtx = context;
        pref = context.getSharedPreferences(PREFERENCES_NAME, PREFERENCES_MODE);
        editor = pref.edit();
    }


    private final static String FRAME = "FRAME";

    /**
     * Sets selected frame mode 
     * @param frame id
     */
    public void setFrameMode(int frameId){
        editor.putInt(FRAME, frameId);

        Log.d(PREFERENCES_NAME, "SET MODE="+frameId);
        boolean success = editor.commit();
        Log.d(PREFERENCES_NAME, "SET MODE="+success);
    }
    /**
     * Gets selected frame mode 
     * @return frame id
     */
    public int getFrameMode(){
        Log.d(PREFERENCES_NAME, "GET MODE="+pref.getInt(FRAME, 0));
        return pref.getInt(FRAME, 0);
    }

SOLVED:

private final static int PREFERENCES_MODE = Context.MODE_MULTI_PROCESS;
  • 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-09T15:02:20+00:00Added an answer on June 9, 2026 at 3:02 pm
    private final static int PREFERENCES_MODE = Context.MODE_MULTI_PROCESS;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

have written this little class, which generates a UUID every time an object of
Have a procedure which looks like Procedure TestProc(TVar1, TVar2 : variant); Begin TVar1 :=
Have deployed numerous report parts which reference the same view however one of them
I have a custom dialog which described below. My Custom Dialog layout ( *my_dialog.xml*
Im kinda stuck. I have an activity in my app that just wont go
Have one Doubt In MVC Architecture we can able to pass data from Controller
Have anyone used Redmine Documentor which lets you convert PHP to HTML to Redmine
Have the following scenario. I have a few form, which essentially have a few
have different files with same name, in different directories. In these files there are
I have implemented button which clicks and opens dialog with spinner inside as described

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.