How to set download path and get the download path?
<pre><code>      request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS,nameOfFile);
</code></pre>

<p>How to read the downloaded file from that dir.</p>

<pre><code>          File file = new File(Environment.DIRECTORY_DOWNLOADS,nameOfFile);
            MimeTypeMap map = MimeTypeMap.getSingleton();
            String ext = MimeTypeMap.getFileExtensionFromUrl(file.getName());
            String type = map.getMimeTypeFromExtension(ext);
</code></pre>

<p>Getting the error that file could not be accessed.</p>