title: Acces to Assets file in android application
body: <p>I have got a problem with my application.
  I try to access the Assets folder and download some PDF files in a directory.</p>
  
  <p>When i try the code on my galaxy S9 (API 28) it is working just fine.
  But when i try the code on my Galaxy S2 tab (API24) nothing happen.</p>
  
  <p>I use this code to access and download the pdf files :</p>
  
  <pre><code>        public void copyAssets(Context context)
          {
              DownloadComplete = false;
              Log.d("tag", "Here 1 ?");
              AssetManager assetManager = context.getAssets();
              Log.d("tag", "Here 2 ?");
              String[] files = null;
              Log.d("tag", "Here 3?");
              try
              {
                  files = assetManager.list(resAventure + "/");
                  Log.d("tag", "Here  4?");
              } catch (IOException e) {
                  Log.d("tag", "Failed to get asset file list.", e);
              }
              if (files != null) for (String filename : files)
              {
                  Log.d("tag", "Here 5?");
                  InputStream in = null;
                  OutputStream out = null;
                  try {
                      Log.d("tag", "Here 6?");
                      in = assetManager.open(resAventure + "/" + filename);
                      out = new FileOutputStream(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Download/Escape/" + resAventure + "/" + filename);
                      copyFile(in, out);
                      Toast.makeText(getApplicationContext(), "Téléchargement effectué sur l'appareil", Toast.LENGTH_LONG).show();
                      DownloadComplete = true;
  
                  } catch(IOException e) {
                      Log.d("tag", "Failed to copy asset file: " + filename , e);
                  }
                  finally
                  {
                      if (in != null)
                      {
                          try
                          {
                              in.close();
                              in = null;
                          } catch (IOException e)
                          {
                              Log.d("tag", "Failed A", e);
                          }
                      }
                      if (out != null)
                      {
                          try {
                              out.flush();
                              out.close();
                              out = null;
                          } catch (IOException e)
                          {
                              Log.d("tag", "Failed B", e);
                          }
                      }
                  }
              }
          }
          public  void copyFile(InputStream in, OutputStream out) throws IOException
          {
              byte[] buffer = new byte[1024];
              int read;
              while((read = in.read(buffer)) != -1){
                  out.write(buffer, 0, read);
              }
          }
  </code></pre>
  
  <p>In API28 everything is OK. But in API24 i only have in the log :</p>
  
  <pre><code>D/ViewRootImpl@45de4c3[documents]: ViewPostImeInputStage processPointer 1
  D/tag: Here 1 ?
  Here 2 ?
  Here 3?
  D/tag: Here  4?
  D/ViewRootImpl@45de4c3[documents]: ViewPostImeInputStage processPointer 0 
  </code></pre>
  
  <p>Is there a difference between the two API for the ASSETS FOLDER ?
  I don't understand why it's working only once...</p>
  
  <p>Can somoene help me please ?</p>