私はアンドロイド開発に非常に慣れていません。ユーザーが入力するフォームを作成しました。そのデータをタブ区切りの文字列で外部ファイルに保存し、後で抽出または電子メールで送信できる関数を作成しようとしています。ただし、ファイルに新しい文字列を書き込むたびに、既存の文字列が上書きされます。ヘルプ!
これは、ファイルに行を追加するコードです。
if(hasExternalStoragePrivateFile()){
File file = new File(getExternalFilesDir(null), fileNameSetting.getString(OUTPUT_FILE_NAME, ""));
String inputLine = generateLine();
try{
OutputStream os = new FileOutputStream(file);
PrintWriter out = new PrintWriter(os);
out.println(inputLine);
out.flush();
out.close();
}catch (java.io.IOException e) {
}
Log.v(DEBUG_TAG, "Line Added");
}
questionScreen1.this.finish();