Shared Preferences commit() calls (Android)
Shared Preferences commit() is synchronous, you should avoid calling it from your main thread because it could pause your UI rendering.
As a replacement, you can use apply() which changes the in-memory SharedPreferences object immediately but writes the updates to disk asynchronously.
Updated about 2 years ago