Writing data to the file in android
<p>This code overwrites the file....</p>

<p>I want my previous data to remain the same..</p>

<pre><code>osw..append (data);  
</code></pre>

<p>but did not get the result</p>

<pre><code>public void WriteSettings(Context context, String data){ 
             FileOutputStream fOut = null; 
             OutputStreamWriter osw = null;

             try{
              fOut = context.openFileOutput("abc.txt",Context.MODE_PRIVATE);       
              osw = new OutputStreamWriter(fOut); 
              osw.write(data); 
              osw.flush(); 
              Toast.makeText(context, "Settings saved",Toast.LENGTH_SHORT).show();
              } 
              catch (Exception e) {       
              e.printStackTrace(); 
              Toast.makeText(context, "Settings not saved",Toast.LENGTH_SHORT).show();
              } 
              finally { 
                 try { 
                        osw.close(); 
                        fOut.close(); 
                        } catch (IOException e) { 
                        e.printStackTrace(); 
                        } 
              } 
         }
</code></pre>
