string保存到文件

private static String path = Environment.getExternalStorageDirectory() + "/log.txt";

private static void saveFile(String content) {

	FileWriter fwriter = null;
	try {
		fwriter = new FileWriter(path);
		fwriter.write(content);
	} catch (IOException ex) {
		ex.printStackTrace();
	} finally {
		try {
			fwriter.flush();
			fwriter.close();
		} catch (IOException ex) {
			ex.printStackTrace();
		}
	}
}


猜你喜欢

转载自blog.csdn.net/yongwoozzang/article/details/80526061
今日推荐