Skip to content

Instantly share code, notes, and snippets.

@championswimmer
Created December 17, 2021 05:58
Show Gist options
  • Save championswimmer/0870892bc9f2804e65600e0f5136a92d to your computer and use it in GitHub Desktop.
Save championswimmer/0870892bc9f2804e65600e0f5136a92d to your computer and use it in GitHub Desktop.
AsyncTaskExample.java
class MyTask extends AsyncTask {
void onPreTask() {
// step 1: this runs on main thread
}
void onTastExecute() {
// step 2: this runs on a separate background thread
}
void onPostTask() {
// step 3: after all things in step2 are done, this runs,
// but again on main thread
}
}
// ===========
MyTask t = new MyTask();
t.execute();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment