Last active
February 18, 2016 12:35
-
-
Save wakim/c139b68eeeeae0b36374 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
public class HeavyWorkTask extends AsyncTask<String, Void, String> { | |
TextView mStatusTextView; | |
public HeavyWorkTask(TextView statusTextView) { | |
mStatusTextView = statusTextView; | |
} | |
@Override | |
protected String doInBackground(String... urls) { | |
return doHeavyWork(urls[0]); | |
} | |
@Override | |
protected void onPostExecute(String result) { | |
mStatusTextView.setText(result); | |
} | |
String doHeavyWork(String url) { | |
// realiza algum trabalho e retorna o resultado do processamento | |
return ...; | |
} | |
} | |
new HeavyWorkTask(mStatusTextView).execute(url); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment