Basic use of lifecycle functions #152
Unanswered
joejackson3
asked this question in
Q&A
Replies: 1 comment 7 replies
-
For Android, you can use one of the Android extensions provided by Essenty (as mentioned in the readme). For example, you can do the following in Activity. class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val lifecycle = essentyLifecycle()
val someLogic = SomeLogic(lifecycle = lifecycle)
}
} |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is a very promising library. So far, I haven't been able to figure out how to use it for my Kotlin Multiplatform project.
My only real requirement is to run a OnResume function to update my main activity, when it is brought back into focus from background.
I am not clear where to instantiate the functions:
Do I need to call
lifecycleRegistry.subscribe()
from the Composable of the activity in question?What I'm currently doing in my main module is define the SomeLogic class:
then instantiate the members in the Composable of the main activity:
The OnResume function is however never called.
The OnResume function is however never called.
Any advice or reference to sample projects would be highly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions