SplashScreen icon indicating copy to clipboard operation
SplashScreen copied to clipboard

Use ktx lifecycleScope

Open JohannesPtaszyk opened this issue 5 years ago • 2 comments

I would recommend to use the coroutines lifecycleScope provided by the androidx libraries to make the coroutines approach even cleaner:

https://developer.android.com/topic/libraries/architecture/coroutines#lifecyclescope

Other than that it's a great article!

JohannesPtaszyk avatar Feb 21 '20 15:02 JohannesPtaszyk

I would recommend to use the coroutines lifecycleScope provided by the androidx libraries to make the coroutines approach even cleaner:

https://developer.android.com/topic/libraries/architecture/coroutines#lifecyclescope

Other than that it's a great article!

Hi! Can you give us an example of a SplashScreen using these coroutines?

Thanks!

brunoaduarte avatar Dec 06 '20 18:12 brunoaduarte

It would be the same as the Coroutines Activity example, but instead of defining your own CoroutineScope, you would use this:

activity.lifecycleScope.launch {
// scope bound to Activity Lifecycle
}

JohannesPtaszyk avatar Dec 08 '20 11:12 JohannesPtaszyk