title: Downloading multiple files one by one using AsyncTask?
body: <p>I'm trying to download multiple files one by one (file is downloaded, we start downloading the next file). Using this method I can keep track of the files being downloaded. The problem is that I'm using the following code for executing a Task:</p>
  
  <pre><code>                File file = null;                
                  for(int i=0; i&lt; videos.length; i++) {
                       file = new File(root.getPath() + videos[i]);
                       boolean exists = file.exists();
                       if(exists){
                           //tv.append("\n\n"+fileNames[i]+" already exists");
                           continue;
                       }
                       else {
                           currentFile = videos[i];
                           new DownloadFileAsync().execute(videoURL+videos[i],videos[i]);            
  
                       }
                       file = null;
                  }
  </code></pre>
  
  <p>As you can see, I call new DownloadFileAsync().execute(videoURL+videos[i],videos[i]); in a loop which obviously start a task for each of the files and downloads them simultaneously. </p>
  
  <p><strong>My question is</strong>: How can I run execute the task for a specific file, check if it has been downloaded-  if yes, proceed with next file by executing a task for it? </p>