-
Jetpack Compose get activity in Composable from LocalContext.
Next
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// val activity = LocalContext.current.findActivity() | |
tailrec fun Context.findActivity(): AppCompatActivity? = when (this) { | |
is AppCompatActivity -> this | |
is ContextWrapper -> baseContext.findActivity() | |
else -> null | |
} |
Featured essays
Sketch Vector Graphics (SVG) for Android
The two following medium articles are explaining the best strategy How to export clean . svg icons with Sketch Tips for exporting vector assets from Sketch to AndroidDesign best practices for Android mobile App (with SketchApp) In a nutshell: Avoid using… more
Remove git HEAD branch
HEAD is a pointer to a commit (usually master) so when you checkout your repository the commit which HEAD points at will be checked out. Usually you'd want it if when checking out you want a different branch or tag to be checked out… more
MVP vs MVVM vs MVI
Short summary of this really well written article:Pattern overview MVP, MVVM, and MVI are some of the common patterns in Android and they can broadly be thought of as different flavours of the same core concept — abstracting logic from the UI into… moreDIY Geiger Counter
After watching HBO's Chernobyl Series and stumbling upon this awesome article about someone building a steampunk desktop background radiation monitor I was inspired to build a radiation monitor myself. I'm aleady being using a Raspberry PI with pi-hole… more