The question is how to append to an existing file. I'm using MODE_APPEND with FileOutputStream fos = openFileOutput("filename", MODE_APPEND);. The file is created and the object is saved, but when I call the method again on the same file - nothing happens. MODE_PRIVATE works but only for 1 insert as it creates a new file every time it's called. I spent the whole day researching and I couldn't find any answer so I am desperate for your help.
public void createFile (View V) throws IOException, JSONException {
    JSONArray resultsLog = new JSONArray();
    JSONObject exercise2;
    String pickVal1 = stringArray[numPick1.getValue()];
    String pickVal2 = stringArray[numPick2.getValue()];
    String pickVal3 = stringArray[numPick3.getValue()];
    String pickVal4 = stringArray[numPick4.getValue()];
    exercise2 =new JSONObject();
    exercise2.put("rep", pickVal1 + " kg  " + pickVal2 + " kg  " + pickVal3 + " kg  " + pickVal4 + " kg  ");
    exercise2.put("type", caller + "  on  " + date);
    resultsLog.put(exercise2);
    String text= resultsLog.toString();
    FileOutputStream fos = openFileOutput("resultsDat3", MODE_APPEND);
    fos.write(text.getBytes());
    fos.close();
    //displayText(this,R.id.stext,resultsLog.toString());
    // finish();
}