Created
May 15, 2017 00:01
-
-
Save julianfalcionelli/63d3690021a043884c81c62dae639d4c to your computer and use it in GitHub Desktop.
Handler & Thread - Alternative 2
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
//... | |
final Handler handler = new Handler(); | |
final Runnable uiRunnable = new Runnable() { | |
@Override | |
public void run() { | |
mTextView.setText(mResult); | |
} | |
}; | |
Thread thread = new Thread(new Runnable() { | |
public void run() { | |
mResult = performBlockingTask(); | |
handler.post(uiRunnable); | |
} | |
}); | |
thread.start(); | |
//... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment