Reputation: 17364
I want to use SharedPreferences between multiple activities and the idea is that I'll have one class that access the SharedPreferences and returns it to different activities via static methods. My question is: since SharedPreferences needs a context to be initialized and I'll be giving it different contexts from different activities will the values still be accessible?
All help is appreciated!
Upvotes: 10
Views: 2713
Reputation: 67502
The Context
provided to .getSharedPreferences()
is only there to let the system access your application-specific information; every Activity
in your app shares the same preferences.
Upvotes: 18