2

I am using DownloadManager.Query to create a query in order to filter out the files in the DownloadManager in Android.

I am doing a:

DownloadManager.Query query = null;
downloadManager = (DownloadManager)getSystemService(DOWNLOAD_SERVICE);
query = new DownloadManager.Query();
query.setFilterByStatus(DownloadManager.STATUS_FAILED);

I was wondering if I could filter out not just 'FAILED' downloads but also 'PENDING' and 'RUNNING', using the same query?

SherinThomas
  • 1,881
  • 4
  • 16
  • 20

1 Answers1

3

You can achieve this by combining the status flags:

query.setFilterByStatus(DownloadManager.STATUS_FAILED|DownloadManager.STATUS_PENDING|DownloadManager.STATUS_RUNNING);

The Android Javadocs for DownloadManager.Query.setFilterByStatus() state that the one parameter can be "any combination of the STATUS_* bit flags".

Mark Allison
  • 21,839
  • 8
  • 47
  • 46