ここでそれを行う方法が完全に説明されていますが、唯一の問題は次のとおりです。彼は機能を知りませんopenFileOutput()
。
private void saveSettingsFile() {
String FILENAME = "settings";
String string = "hello world!";
FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE); //openFileOutput underlined red
try {
fos.write(string.getBytes());
fos.close();
} catch (IOException e) {
Log.e("Controller", e.getMessage() + e.getLocalizedMessage() + e.getCause());
}
}
それらは私がインポートした関連パッケージです:
import java.io.FileOutputStream;
import java.io.IOException;
import android.content.Context;