5

Are shared preferences in Android always read at startup and stored in memory during runtime? If not, are there more efficient ways to read preferences than this?

settings = getSharedPreferences("myPrefsFile", 0);
int answer = settings.getInt("ULTIMATE_QUESTION", 42);
Krøllebølle
  • 2,878
  • 6
  • 54
  • 79

1 Answers1

2

Are shared preferences in Android always read at startup and stored in memory during runtime

Simply Yes till user doesn't clear it manually from setting.

are there more efficient ways to read preferences than this

As JonasCz said in comments.. this is the most common and developer friendly way till now.

Ranjit
  • 5,130
  • 3
  • 30
  • 66