Kotlin singletons with argument
object has its limits
In Kotlin, the singleton pattern is used as a replacement for static members and fields that don’t exist in that programming language. A singleton is created by simply declaring an
I took a quick look at the documentation of this library and I don’t like the approach of storing everything in the
Application class for different reasons.
Like I explained in the article, the Application is not always the first thing getting initialized in an app, and
Context.getApplicationContext() can not always be cast…
I said it was misleading because the message I got from the article is: “My app has fragment crashes. I’ll just replace all my fragment transactions with this code. Done!” Now it won’t crash, but I have another problem: the behavior has changed. In some cases the fragment may not have been replaced at all and because the example function has no…