Skip to content

Instantly share code, notes, and snippets.

@prof18
Created January 11, 2019 21:49
Show Gist options
  • Save prof18/d9fc7813e9058a7e00f28c11f13c9284 to your computer and use it in GitHub Desktop.
Save prof18/d9fc7813e9058a7e00f28c11f13c9284 to your computer and use it in GitHub Desktop.
coroutineScope.launch(Dispatchers.Main) {
try {
val parser = Parser()
val articleList = parser.getArticles(url)
setArticleList(articleList)
} catch (e: Exception) {
e.printStackTrace()
_snackbar.value = "An error has occurred. Please retry"
setArticleList(mutableListOf())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment