title: Open a downloaded file after downloading in Android
body: <p>I have an app with some links to files on the web. I want that after the user choose to download a file to the device - the file will be opened automatically.
  This is my code for downloading: </p>
  
  <pre><code>private void downloadFile(String url) {
  
          if (GeneralHelper.isNetworkAvailable(this)) {
              Uri uri = Uri.parse(url); 
              DownloadManager.Request r = new DownloadManager.Request(uri);
  
              String fileName = url.substring( url.lastIndexOf('/')+ 1, url.length() );
  
              // This put the download in the same Download dir the browser uses
              r.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fileName);
              r.allowScanningByMediaScanner();
  
              // Notify user when download is completed
              // (Seems to be available since Honeycomb only)
              r.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
  
              // Start download
              DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
              dm.enqueue(r);
  
          }
          else {
              // ....
          }
  
      }
  </code></pre>
  
  <p>How can I add a code to open the file after the downloading is done?</p>