title: New line writing to a file
body: <p>I am trying to write to a file the log of my application. I have created an method which appends a line to the end of the line.</p>
  
  <pre><code>    public static void write2Log(String s){
      StringBuilder contents = new StringBuilder();
      File root = Environment.getExternalStorageDirectory();
      File logFile = new File(root, "testWrite2file.log");
  
      if (root.canWrite()){               
          try {
              BufferedReader input =  new BufferedReader(new FileReader(logFile));
              String line = null;                            
              while (( line = input.readLine()) != null){
                contents.append(line);
               // contents.append(System.getProperty("line.separator"));            
          }
          input.close();
          FileWriter logWriter = new FileWriter(logFile);                  
          BufferedWriter out = new BufferedWriter(logWriter); 
          out.write(contents.toString()+"\r\n"+s);////&lt;---HERE IS MY QUESTION
          out.close();
          }
  
          catch (IOException e) {
              Log.e("test", "Could not read/write file " + e.getMessage());
          }
      }
  }
  </code></pre>
  
  <p>Everything works fine less the new character line.</p>
  
  <p>I have tried using: </p>
  
  <pre><code>\r\n
  
  System.getProperty("line.separator")
  
  newline()
  </code></pre>
  
  <p>But i keep getting all in just one line :(</p>
  
  <p>Any ideas?</p>