title: Android - can save file in USB Device but not in Emulator
body: <p>I'm trying to transfer a file from PC to an android app.My code works when I use a USB device and I can see my sent file in Downloads. However I can't manage to do the same when using an emulator and it gives me the "ENOENT (No such file or directory) " exception.here is my code:</p>
  
  <pre><code>IncomingFileTransfer transfer = request.accept();
  File path = Environment.getExternalStoragePublicDirectory(
          Environment.DIRECTORY_DOWNLOADS);
  File file = new File(path, "/" +  transfer.getFileName());
  try{
      transfer.recieveFile(file);//problem
      while(!transfer.isDone()) {
          try{
              Thread.sleep(1000L);
          }catch (Exception e) {
              e.printStackTrace();
          }
          if(transfer.getStatus().equals(FileTransfer.Status.error)) {
             System.out.println(transfer.getError());
          }
          if(transfer.getException() != null) {
              transfer.getException().printStackTrace();
          }
      }
      System.out.println("file received");
  }catch (Exception e) {
      e.printStackTrace();
  }
  </code></pre>
  
  <ul>
  <li><p>I use the following permission in manifest:</p>
  
  <p><code>&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt;</code>   </p></li>
  <li><p>my minSdkVersion and targetSdkVersion are both 17</p></li>
  <li><p>"protect sd card" option in my emulator is unchecked</p></li>
  <li><p><a href="https://i.stack.imgur.com/JaoX6.jpg" rel="nofollow noreferrer">here is my emulator settings</a></p></li>
  </ul>
  
  <p>Thanks in advance!</p>