title: How to save downloaded files in the cache folder of the app's memory?
body: <p>I'm aware similar questions have been asked before but there really isn't a working solution. I am downloading multiple PDF files through the DownloadManager and I want to save these files into the cache folder of the app's memory but couldn't find any way of doing that.</p>
  
  <p>This is my code:</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
      Button btn;
      DownloadManager downloadManager;
      List&lt;String&gt; myList = new ArrayList&lt;String&gt;();
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          myList.add("https://doc.lagout.org/programmation/Actionscript%20-%20Flash%20-%20Flex%20-%20Air/Flash%20Development%20for%20Android%20Cookbook%20-%20Labrecque%20-%20Packt%20%282011%29/Flash%20Development%20for%20Android%20Cookbook%20-%20Labrecque%20-%20Packt%20%282011%29.pdf");
          myList.add("http://www.csc.kth.se/utbildning/kth/kurser/DD143X/dkand11/Group1Mads/andreas.ulvesand.daniel.eriksson.report.pdf");
          myList.add("http://enos.itcollege.ee/~jpoial/allalaadimised/reading/Android-Programming-Cookbook.pdf");
          myList.add("https://x.coe.phuket.psu.ac.th/warodom/242-320/ebook/9781785883262-ANDROID_PROGRAMMING_FOR_BEGINNERS.pdf");
          myList.add("https://www.cs.cmu.edu/~bam/uicourse/830spring09/BFeiginMobileApplicationDevelopment.pdf");
          myList.add("https://commonsware.com/Android/Android-1_0-CC.pdf");
  
          btn = findViewById(R.id.download_btn);
          btn.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  downloadManager = (DownloadManager)getSystemService(Context.DOWNLOAD_SERVICE);
                  for(int i = 0; i &lt; myList.size(); i++) {
                      Uri uri = Uri.parse(myList.get(i));
                      DownloadManager.Request request = new DownloadManager.Request(uri);
                      request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
                      Long reference = downloadManager.enqueue(request);
                  }
              }
          });
      }
  }
  </code></pre>