1

I have a PreferenceActivity, but some of the settings can be modified from another Activities also. But when a user modifies a setting from another activity, and then goes to the PreferenceActivity this change is not reflected there.

How can I make the change made from outside be reflected in the PreferenceActivity?

public class SettingsActivity extends PreferenceActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        addPreferencesFromResource(R.layout.settings);
    }
}

and here is the code from another activity

SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(Application.getApplication());
SharedPreferences.Editor editor = settings.edit();
editor.putBoolean("my_setting", true);
editor.commit();
netimen
  • 4,199
  • 6
  • 41
  • 65
  • QA discussed here : http://stackoverflow.com/questions/4619724/accessing-another-activitys-preferences – gtiwari333 Oct 18 '11 at 16:38
  • the better matching question is http://stackoverflow.com/questions/7466189/reload-preferences-in-preferenceactivity-on-resume – netimen Oct 26 '11 at 13:19
  • another useful post: http://androidcookbook.com/Recipe.seam;jsessionid=184679960D7135D361B76DB5827C8393?recipeId=561&recipeFrom=ViewTOC – netimen Oct 26 '11 at 13:37

0 Answers0