One*_*rld 7 file-io android fileoutputstream java-io
这里完美地描述了如何做到这一点,唯一的问题是:他不知道这个功能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());
}
}
Run Code Online (Sandbox Code Playgroud)
这些是我导入的相关包:
import java.io.FileOutputStream;
import java.io.IOException;
import android.content.Context;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
17498 次 |
| 最近记录: |