title: Can't see a file in Windows written by an Android app on SD card unless I "Force Close" the app
body: <p>I wrote a file through my Android program like this:</p>
  
  <pre><code>String file = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Files/hello.txt";
  BufferedWriter writer = new BufferedWriter(new FileWriter(file));
  writer.write(str + "\n");     \\ Yeah, 'str' has a value there
  writer.close();
  </code></pre>
  
  <p>The program does its job and it finishes. Now I hit the back button on Android to close the application. If I then go to an Android file browser (like Astro) I can see the file, but if I mount the SD card on Windows, I can't see the file!</p>
  
  <p>Now, if I go to <em>Settings</em> → <em>Applications</em> → <em>Manage Applications</em> → <em>"Force Stop" &lt;application></em>, I'm able to see the file even in Windows.</p>
  
  <p>What should I do so that I can see a file in Windows if the file is written by my Android app on the SD card and I don't want to go to settings and hit force close every time. </p>
  
  <p>Actually the file is being written properly (I think), but since the default behaviour of Android 'back' button doesn't kill the app, and it looks like unless the app is killed I can't open the file outside Android (in Android, I'm still able to see it and even open it). </p>
  
  <p>So, what would be the best solution for this case? Should I automatically kill the app when it is closing? People say that System.exit() is strictly not recommended.</p>