Last active
March 17, 2018 18:46
-
-
Save mRB0/ad3f256194511226a72ec80e13aa2d44 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
private val loadJob: Job? = null | |
fun onClick() { | |
loadJob?.cancel() | |
loadJob = async(UI) { | |
val image = loadImage() // suspend fun loadImage | |
imageView.image = image | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment