title: Android: How to write newline in CSV file?
body: <p>I am trying to organize my data in .CSV file.I want to put my data in a particular row so i tried putting "\n" but it is not working.Please help me in putting data to a particular row.Thank you in advance..</p>
  
  <pre><code>public void writeData(String data,String strFilePath)
          {
  
              PrintWriter csvWriter;
              try
              {
  
                  File file = new File(strFilePath);
                  if(!file.exists()){
                      file = new File(strFilePath);
                  }
                  csvWriter = new  PrintWriter(new FileWriter(file,true));
  
  
                  csvWriter.print(data+","+"hello");
                  csvWriter.append('\n');
                  csvWriter.print("world");
  
  
                  csvWriter.close();
  
  
              }
              catch (Exception e)
              {
                  e.printStackTrace();
              }
          }
  </code></pre>