Downloading multiple files one by one using AsyncTask?
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:

                    File file = null;                
        	        for(int i=0; i< 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;
        	        }

     
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. 

**My question is**: 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? 
Downloading multiple files one by one using AsyncTask?
===

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:

                    File file = null;                
        	        for(int i=0; i< 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;
        	        }

     
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. 

**My question is**: 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? 