title: How to set append mode to append content to a text file in android?
body: <p>I use the following code to write text content to MessageCleanupLogs.txt, it seems that it's a overwrite mode, when I run the code again, the previously created MessageCleanupLogs.txt is overwrite.</p>
  
  <p>How can I set append mode for the file MessageCleanupLogs.txt to append new content? Thanks!</p>
  
  <pre><code>       String filename=Environment.getExternalStorageDirectory() + "/MessageCleanupLogs.txt";
  
          try
          {
              File file = new File(filename);
              if (!file.exists()) {
                  file.createNewFile();
              }
  
              String aa="a\r\nb\r\nb";
  
              FileOutputStream fOut = new FileOutputStream(filename);
              OutputStreamWriter myOutWriter = new OutputStreamWriter(fOut);
              myOutWriter.append("test");
              myOutWriter.append("\r\n");
              myOutWriter.append(aa);
              myOutWriter.close();
              fOut.close();
  
          } catch (Exception e) {
  
          }
  </code></pre>