Last active
September 20, 2015 17:54
-
-
Save ptsiogas/a1c26ea0a87d4e2bf4d9 to your computer and use it in GitHub Desktop.
Run an Async Task (Android)
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
//Declare variable and execute async | |
DownloadFilesTask mDonwloadFilesTask; | |
mDonwloadFilesTask = new DownloadFilesTask(); | |
mDonwloadFilesTask.execute(""); | |
//---------------------------------- | |
public class DownloadFilesTask extends AsyncTask<String, Void, String> { | |
protected String doInBackground(String... params) { | |
//do all the heavy staff here but dont you dare messing with the UI! | |
return "Executed!"; | |
} | |
@Override | |
protected void onPostExecute(String result) { | |
//here you can even change the layout | |
} | |
@Override | |
protected void onPreExecute() {} | |
@Override | |
protected void onProgressUpdate(Void... values) {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment