title: android - FileDownloader: Tasks with the listener can't start
body: <p>I use <a href="https://github.com/lingochamp/FileDownloader" rel="nofollow noreferrer">this library</a>, but when I press the "refresh" button in my app, this library displays an error:</p>
  
  <pre><code>W/FileDownloader.FileDownloader: Tasks with the listener can't start, because can't find any task with the provided listener, maybe tasks instance has been started in the past, so they are all are inUsing, if in this case, you can use [BaseDownloadTask#reuse] to reuse theme first then start again: [ru.webant.projects.dossier.activity.MainActivity$7@18e962dd, TRUE]
  </code></pre>
  
  <p>onClick button "refresh":</p>
  
  <pre><code>public void refreshList() {
      if (isOnline()) {
          FileDownloader.getImpl().pauseAll();
          final RestServiceApi apiService = ServiceGenerator.createService(RestServiceApi.class, getString(R.string.base_url), remindToken());
          getContent(apiService);
      } else {
          Toast.makeText(MainActivity.this, getString(R.string.no_internet_connection), Toast.LENGTH_SHORT).show();
      }
  }
  </code></pre>
  
  <p>getContent(apiService) gets the list of files and calls this method:</p>
  
  <pre><code>public void saveFilesOnDisk(final List&lt;Folder&gt; folders, final int index) {
  
  
          final List&lt;File&gt; files = folders.get(index).getFiles();
          progressBar.setProgress(0);
          progressBar.setMax(files.size());
  
          String downloaderFile = "";
  
          final FileDownloadListener queueTarget = new FileDownloadSampleListener() {
  
              @Override
              protected void pending(BaseDownloadTask task, int soFarBytes, int totalBytes) {
                  Log.i("status: ", "pending");
                  super.pending(task, soFarBytes, totalBytes);
  
              }
  
              @Override
              protected void progress(BaseDownloadTask task, int soFarBytes, int totalBytes) {
                  Log.i("status: ", "progress");
                  super.progress(task, soFarBytes, totalBytes);
              }
  
              @Override
              protected void error(BaseDownloadTask task, Throwable e) {
                  Log.i("status: ", "error");
                  super.error(task, e);
                  //task.reuse();
                  //saveFilesOnDisk(folders, 0);
              }
  
              @Override
              protected void connected(BaseDownloadTask task, String etag, boolean isContinue, int soFarBytes, int totalBytes) {
                  super.connected(task, etag, isContinue, soFarBytes, totalBytes);
                  Log.i("connected file: ", task.getPath());
              }
  
              @Override
              protected void paused(BaseDownloadTask task, int soFarBytes, int totalBytes) {
                  Log.i("status: ", "pause");
                  super.paused(task, soFarBytes, totalBytes);
              }
  
              @Override
              protected void completed(BaseDownloadTask task) {
                  super.completed(task);
                  Log.i("download: ", "completed; " + homeFolder + java.io.File.separator + task.getPath());
  
                  progressBar.setProgress(progressBar.getProgress() + 1);
  
                          for (int i = 0; i &lt; files.size(); i++) {
                              String filePath = homeFolder + java.io.File.separator + files.get(i).getPath().substring(2);
                              if (filePath.equals(task.getPath())) {
                                  adapter.notifyItemChanged(i);
                              }
                          }
                  if (progressBar.getProgress() == files.size() - 1) {
                      if (index &lt; folders.size() - 1) {
                          saveFilesOnDisk(folders, index + 1);
                      }
                  }
              }
  
              @Override
              protected void warn(BaseDownloadTask task) {
                  Log.i("status: ", "warn");
                  super.warn(task);
              }
          };
  
          for (int i = 0; i &lt; files.size(); i++) {
              downloaderFile = files.get(i).getPath();
              String fullPath = homeFolder + java.io.File.separator + downloaderFile.substring(2);
              if (!(new java.io.File(fullPath).exists())) {
  
                  final String url;
                  boolean isDir = false;
                  url = "http://..." + downloaderFile;
  
                  FileDownloader.getImpl().create(url)
                          .setPath(fullPath, isDir)
                          .setCallbackProgressTimes(300)
                          .setMinIntervalUpdateSpeed(400)
                          .setListener(queueTarget)
                          .asInQueueTask()
                          .enqueue();
  
              } else {
                  progressBar.setProgress(progressBar.getProgress() + 1);
                  if (index == files.size() - 1) {
                      saveFilesOnDisk(folders, index + 1);
                  }
              }
          }
          FileDownloader.getImpl().start(queueTarget, true);
  }
  </code></pre>
  
  <p>how to handle this error? I want to get all my files</p>