Last active
January 4, 2016 03:19
-
-
Save haroldl/8560731 to your computer and use it in GitHub Desktop.
This file contains 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
val t = findViewById(R.id.textView1).asInstanceOf[TextView] | |
val b = findViewById(R.id.button1).asInstanceOf[Button] | |
b setOnClickListener { | |
view: View => | |
backgroundThread { | |
// Do things like network requests here in the background thread... | |
Thread.sleep(3000) | |
uiThread { | |
// Back on the main thread, update the UI... | |
t.setText("Done with async.") | |
} | |
// More background work... | |
uiThread { | |
// More main thread UI changes... | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment