Run an Async Task (Android)
//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) {}