Skip to content

Instantly share code, notes, and snippets.

View realskyrin's full-sized avatar
🎯
Focusing

skyrin realskyrin

🎯
Focusing
View GitHub Profile
@handstandsam
handstandsam / MyLifecycleOwner.kt
Last active May 19, 2024 02:18
Jetpack Compose OverlayService. You have to have all the correct permissions granted and in your manifest, but if you do, this this will show a green box with "Hello" in it!
import android.os.Bundle
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleRegistry
import androidx.savedstate.SavedStateRegistry
import androidx.savedstate.SavedStateRegistryController
import androidx.savedstate.SavedStateRegistryOwner
internal class MyLifecycleOwner : SavedStateRegistryOwner {
private var mLifecycleRegistry: LifecycleRegistry = LifecycleRegistry(this)
private var mSavedStateRegistryController: SavedStateRegistryController = SavedStateRegistryController.create(this)
@CreatorB
CreatorB / OnBackPressed.java
Last active September 17, 2019 13:16
How to Exit App When Press Back Button - Android
///////////////////////////////BACK-BUTTON-PRESSED/////////////////////////////
//////////////////////////////////creatorb////////////////////////////////////
//You can choose one method ;)
//PopUp
@Override
public void onBackPressed() {
new AlertDialog.Builder(this)
.setTitle("Really Exit?")