YarikSOffice / lingver

Manage your application locale and language.
https://proandroiddev.com/change-language-programmatically-at-runtime-on-android-5e6bc15c758
MIT License
512 stars 61 forks source link

Initializing the library on background thread. #38

Closed mwshubham closed 4 years ago

mwshubham commented 4 years ago

Is there any advantage/disadvantage of initializing the library on a background thread?

YarikSOffice commented 4 years ago

Hey @mwshubham ,

The library was not designed to be initialized on a background thread. However, you can do that even though it's not thread-safe out of the box (init and getInstance() might create a race condition).

Initialization invokes a shared preference under the hood, doing that on a background thread can potentially improve things. However, the library is already light enough and I don't think it can bring any tangible performance improvements.

mwshubham commented 4 years ago

Thanks for your reply. I agree with you that there will be no significant performance improvements in doing the same.