title: How to store new values in existing csv file in Android?
body: <p>I am working on an ANDROID project where i have to create a CSV file from some data.
  I am able to create csv file and store data by creating Captions.</p>
  
  <p>Code Snippet for that is given Below::</p>
  
  <pre><code>package com.csvtry;
  
  import java.io.File;
  import java.io.FileWriter;
  import java.io.IOException;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.os.Environment;
  
  public class csvtry extends Activity {
      public static String abc=null;
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          generateCsvFile("Example1.csv"); 
  
      }
      private static void generateCsvFile(String sFileName)
      {
          try
          {
              File root = Environment.getExternalStorageDirectory();
              File gpxfile = new File(root, sFileName);
              FileWriter writer = new FileWriter(gpxfile);
  
              abc="Guwahati";
  
              writer.append("Emp_Name");
              writer.append(',');
              writer.append("Adress");
              writer.append('\n');
  
              writer.append("hussain");
              writer.append(',');
              writer.append("Delhi");
              writer.append('\n');
  
              //generate whatever data you want
  
              writer.flush();
              writer.close();
          }
          catch(IOException e)
          {
              e.printStackTrace();
          } 
       }
  }
  </code></pre>
  
  <p><strong>As in above code, we can see, Example1.csv is created and stored in SDCARD.
  I works absolutely fine....</strong></p>
  
  <p>But i want to write some new data in new rows and columns in Example1.csv.</p>
  
  <p>But when i try to run emulator again with some new data, it replaces existing  row data.</p>
  
  <p><strong>My question is that, how can we write new data in new row without replacing previous data?
  How to write new data in new rows ???</strong></p>
  
  <p>I am stuck on this...Please give me suggestions how to proceed ..</p>
  
  <p>Thanks in advance....</p>