public class FileService {
private Context context;
public void save(String filename, String filecontent) throws Exception {
//Context.MODE_PRIVATE,文件私有保存模式。保存的文件不能被其他应用所访问,而且以覆盖的形式保存文件
FileOutputStream fileOutputStream = context.openFileOutput(filename, Context.MODE_PRIVATE);
fileOutputStream.write(filecontent.getBytes());
fileOutputStream.flush();
fileOutputStream.close();
}
}