title: export sqlite into csv
body: <p>im trying to take data from my sqlite database and write it into csv file and email the information when done writing.i only have one Table with 3 columns in the database.i have DBAdapter and a class that have the Button that the user must press  to be able to export the data.</p>
  
  <p>Here is the code i have tried <strong>Exportdata.java</strong></p>
  
  <pre><code>try {
      root = Environment.getExternalStorageDirectory();                   
      Log.i(TAG,"path.." +root.getAbsolutePath());  
  
      //check sdcard permission  
      if (root.canWrite()) {  
          File fileDir = new File(root.getAbsolutePath()+"/fun/");  
          fileDir.mkdirs();  
  
          //   Log.d("DATABASE", db.getAllBYname());
  
          File file= new File(fileDir, "itisfun.csv");  
          FileWriter filewriter = new FileWriter(file);  
          BufferedWriter out = new BufferedWriter(filewriter);  
          out.write("I m enjoying......dude..............."  ); 
          out.close();  
      }  
  } catch (IOException e) {  
      Log.e("ERROR:---", "Could not write file to SDCard" + e.getMessage());  
  } 
  </code></pre>
  
  <p>This code does create the file in SDcard but the problem is i cant make this to take sqlite database data and write it in the file as shown on the code.im stuck please help me with example or edit my code with the right solution.</p>