Skip to content

Instantly share code, notes, and snippets.

@mdakram
Forked from jgilfelt/gist:1231694
Created December 12, 2013 06:08
Show Gist options
  • Save mdakram/7923847 to your computer and use it in GitHub Desktop.
Save mdakram/7923847 to your computer and use it in GitHub Desktop.
private void asyncTaskWithInlineCallback() {
// display UI progress indicator
// ...
new MyAsyncTask() {
protected void onPostExecute(Boolean result) {
// dismiss UI progress indicator
// process the result
// ...
}
}.execute(); // start the background processing
}
class MyAsyncTask extends AsyncTask<Void, Integer, Boolean> {
@Override
protected Boolean doInBackground(Void... arg0) {
// do background processing and return the appropriate result
// ...
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment