title: Reboot to view files on Android external storage
body: <p>I have created a simple application to take some user data and write it to a text file which gets saved on the external storage of my device. However, I am unable to access those files using my computer until after I have rebooted my device. Can anyone tell me why this is and if there is something I can do to fix it?</p>
  
  <p>Here is the code I use to write data.</p>
  
  <pre><code>private void commitToFile(String worldOrApp, String xPos, String yPos, String orient) {
      Intent intent = getIntent();
      String filename = intent.getStringExtra(MainActivity.FILENAME) + ".txt";
      final String position = worldOrApp + " - x: " + xPos + "; y: " + yPos + "; alpha: " + orient + "\r\n";
      File myPath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
      File myFolder = new File(myPath.getAbsolutePath()+"/test_folder");
      if (!myFolder.exists()) {
          myFolder.mkdirs();
      }
      File myFile = new File(myFolder, filename);
      try {
      FileOutputStream fileOutputStream = new FileOutputStream(myFile, true);
      OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream);
          outputStreamWriter.write(position);
          outputStreamWriter.flush();
          outputStreamWriter.close();
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  </code></pre>