I'm used to calling runOnUiThread() to ensure that a block of code gets run, well, on the UI thread. I would like the same ease to launch a block of code off the UI thread. What should that method look like?
I suppose you would say the method is start()
:
new Thread() {
public void run() {
// do something
}
}.start();
or use AsyncTask
or some Executor
from java.util.concurrent
or whatever.
You most likely want an AsyncTask
. Refer to this article: http://developer.android.com/resources/articles/painless-threading.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With