Anhängen der Datei führt zum Überschreiben (Java)

Ich erstelle also eine CSV-Datei und möchte bei jeder Aktion die Daten in die Datei schreiben. Das Problem, das ich habe, ist, dass es die Daten überschreibt, wenn es das zweite Mal eingibt. Wie füge ich die Daten am Ende der Datei hinzu?

<code> public boolean save_to_csv(){

    //check if directory exists, if not create the folder
    File folder = new File(Environment.getExternalStorageDirectory() + "/HKA_CAL");
    //Environment.getExternalStorageDirectory() get the location of external storage
    boolean success = true;
    if(!folder.exists())
    {
       success = folder.mkdir();
    }         
    if (success) 
    { 
        //success is true if folder has successfully been created
        //now we can create/check if the file exists

        File stored_hka = new File(Environment.getExternalStorageDirectory()+"/HKA_CAL/Stored_values.csv");
        boolean file_existed=true;

        try{
            if(!stored_hka.exists()){
                stored_hka.createNewFile();
                file_existed=false;
            }
            FileOutputStream fOut = new FileOutputStream(stored_hka);
            OutputStreamWriter myOutWriter = new OutputStreamWriter(fOut);
            if(!file_existed){
                //if the file did not exist we need to write the titles of the csv
                myOutWriter.append("Calibration Tracking\r\n");
                myOutWriter.append(",ZERO1,,Zero2,,cal1,,cal2,,CALIBRATION FACTORS\r\n");
                myOutWriter.append("Date,Stab,Read,Stab,Read,Stab,Read,Stab,Read,Unit S/N,F Zero,F Offset,F Factor\r\n");
            }
            myOutWriter.append("Date"
                    +","+get_step3_stab()+","+get_step3_read()
                    +","+get_step6_stab()+","+get_step6_read()
                    +","+get_step8_stab()+","+get_step8_read()
                    +","+get_step11_stab()+","+get_step11_read()
                    +","+get_sn_num()+","+get_f_zero()
                    +","+get_f_offset()+","+get_f_factor()+"\r\n"
                    );
            myOutWriter.close();
            fOut.close();
        }
        catch(Exception e){
            return false;
        }




        return true;
    }
    else 
    {
        return false;
    }



}
</code>

Antworten auf die Frage(5)

Ihre Antwort auf die Frage