title: How to save downloaded file in internal storage in android studio?
body: <p>I have a download button in my app.When I press the download  button it downloads an audio file from provided url.But the problem is I want to save the file in my internal storage folder called "DownloadTestFolder",it is showing an error.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:gravity="center"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
  
      &lt;Button
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:text="Download"
          android:onClick="Download"
          android:id="@+id/download"/&gt;
  
  &lt;/LinearLayout&gt;</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>public class DownloadTest extends Activity {
  
      DownloadManager downloadManager;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.download_test);
      }
  
      public void Download(View view){
  
          downloadManager=(DownloadManager)getSystemService(Context.DOWNLOAD_SERVICE);
          Uri uri=Uri.parse("My Url");
          DownloadManager.Request request = new DownloadManager.Request(uri);
          try{
              request.setDestinationInExternalPublicDir(getFilesDir()+"/DownloadTestFolder","/");
              request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
              Long reference = downloadManager.enqueue(request);
  
          }catch (Exception e){
              /* Error
          }
  
      }
  }</code></pre>
  </div>
  </div>
  </p>