'Access Shared Preference in main thread
I have like 21 fragments in my production app and all of them either writing or reading shared preferences on UI thread. As I am currently trying to optimize app start-up time. I wonder accessing shared preference directly in fragment onCreate(), onResume() or as part of fragment property variables can add any cost to app start up time?
Solution 1:[1]
Have a look here and here and please read the differences between .apply() and .commit() Using the correct ones should have no visible impact on your app start-up time.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Marius Razvan Varvarei |
