title: How to write a database to a text file in android
body: <p>I am working on a Spying application for my college project purpose. For that i have logged the Calls, Location and SMS of the device and stored them in a database. Now i want to export the contents of the database to a text file.. I tried the below code.</p>
  
  <pre><code>private void readAndWriteCallsData() {
  
      File dataBaseFile = getDatabasePath("DATABASE"); 
  
      File callDataFile = new File(Environment.getDataDirectory()+"/data/com.example.myapp/databases/"+"DATABASE");
  
      try {
  
          BufferedReader dbFileReader = new BufferedReader(new FileReader(callDataFile));
  
          String eachLine;
  
          while((eachLine = dbFileReader.readLine()) != null)
          {
  
                  Callslog.append(eachLine);
                  Callslog.append("\n");
  
          }
  
      } catch (IOException e) {
  
          e.printStackTrace();
      }
  
  
  }
  </code></pre>
  
  <p>But that is not working... Please help me...</p>