Skip to content

Instantly share code, notes, and snippets.

View danielesegato's full-sized avatar

Daniele Segato danielesegato

  • 08:53 (UTC +02:00)
View GitHub Profile
@danielesegato
danielesegato / StaticAndroidApplicationSingleton.kt
Created April 24, 2025 11:07
Accessing the Android Application Context statically - before being horrified, read the comment
package multiplatform
import android.app.Application
import android.content.Context
import kotlin.reflect.KProperty
/**
* Hi developer being horrified at this. Please READ ON. This wasn't done lightly.
*
* There was a post in the long-gone Google+ social by Dianne Hackborn, an Android Framework