Back when I was doing java, I usually would go wit...
# android
j
Back when I was doing java, I usually would go with something like this:
Copy code
class Foo {
     private Foo mShared;
     private Context context;

     public Foo sharedInstance(Context context) {
                if (mShared == null) {
                         mShared == new Foo(context)
                }
                return mShared;
     }
}
l
@jasonlow: I made a small library to access the Application Context anywhere in Kotlin: https://github.com/LouisCAD/Splitties#app-context