https://kotlinlang.org logo
#coroutines
Title
# coroutines
a

Ananiya

07/27/2020, 11:48 AM
I am little bit confused in coroutine. i just tried this code and i want this code to check the network if offline Ops! offline or online You are online it works but when i touch the R*etry(*in snackbar action) button the snack bar dismiss
s

sikri

07/27/2020, 12:48 PM
and what is your question?
a

Ananiya

07/27/2020, 12:51 PM
When I touch Retry in snack bar it dismiss but I want was to check the network
s

sikri

07/27/2020, 1:01 PM
1. check is being started nearly at same time as snackbar is shown 2. you cannot start same coroutine twice,
checkNetwork.start()
after
checkNetwork.join()
won’t do anything as it is already finished 3. you have to think about code structure, try to write in sentences what you wan’t to do and make it declaratively according to what you have written, it will help you and to understand your code as it requires lots of time to understand it
👍 1
4.
Snackbar::setAction
dismisses snackbar after action processing
👍 1
2 Views