Skip to content

Instantly share code, notes, and snippets.

@thecodeside
Last active February 20, 2022 18:01
Show Gist options
  • Save thecodeside/6b288a8546ddc9d4b52a077e65d6f209 to your computer and use it in GitHub Desktop.
Save thecodeside/6b288a8546ddc9d4b52a077e65d6f209 to your computer and use it in GitHub Desktop.
object Graph {
private lateinit var appContext: Application
// lazily initialized singleton scope
val fancyManager by lazy { FancyManager(appContext) }
fun init(appContext: Application) {
this.appContext = appContext
}
}
// Initialization of the Graph in the Application class:
class FancyApp : Application() {
override fun onCreate() {
super.onCreate()
Graph.init(this)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment