title: Android won't write new line in text file
body: <p>I am trying to write a new line to a text file in android.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>FileOutputStream fOut;
  try {
      String newline = "\r\n";
      fOut = openFileOutput("cache.txt", MODE_WORLD_READABLE);
      OutputStreamWriter osw = new OutputStreamWriter(fOut); 
  
      osw.write(data);
      osw.write(newline);
  
      osw.flush();
      osw.close();
  } catch (FileNotFoundException e) {
      e.printStackTrace();
  } catch (IOException e) {
      e.printStackTrace();
  }
  </code></pre>
  
  <p>I have tried <code>\n</code>, <code>\r\n</code> and I did also try to get the system property for a new line, neither of them work.</p>
  
  <p>The data variable contains previously data from the same file.</p>
  
  <pre><code>String data = "";
  
  try {
      FileInputStream in = openFileInput("cache.txt");   
      StringBuffer inLine = new StringBuffer();
      InputStreamReader isr = new InputStreamReader(in, "ISO8859-1");
      BufferedReader inRd = new BufferedReader(isr,8 * 1024);
      String text;
  
      while ((text = inRd.readLine()) != null) {
          inLine.append(text);
      }
  
      in.close();
      data = inLine.toString();
  } catch (FileNotFoundException e1) {
      e1.printStackTrace();
  } catch (IOException e) {
      e.printStackTrace();
  }
  </code></pre>