Last active
December 30, 2015 03:29
-
-
Save stanch/7769231 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
Future { | |
// perform something in background | |
val url = ... | |
val data = fetch(url) | |
process(data) | |
} mapUi { data ⇒ | |
// this will happen on the UI thread | |
display(data) | |
} onFailureUi { | |
// handle failure on the UI thread | |
case NonFatal(t) ⇒ t.printStackTrace() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment