Search code examples
androidandroid-download-manager

Using Android DownloadManager,how do i get file name?


I'm using DownloadManager class to manage downloads, i'm using this

request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS,subPath);

currently i'm setting subPath to some filename but how do i get filename from url?

I don't want to use cursor but some way to extract file name from uri.


Solution

  • You can use:

    DownloadManager.COLUMN_TITLE
    

    Please look at Android DownloadManager get filename

    Hope this helps!