+
+ public static void write2File(File file, ArrayList<String> content) {
+ String newFileName = Environment.GENERATED_FILE_DIR + "/"
+ + file.getParentFile().getName() + "/" + file.getName();
+
+ File newFile = new File(newFileName);
+ newFile.getParentFile().mkdirs();
+ if (!newFile.exists()) {
+ try {
+ newFile.createNewFile();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ try {
+ BufferedWriter bw = new BufferedWriter(new FileWriter(newFile));
+ for (int i = 0; i < content.size(); i++) {
+ bw.write(content.get(i) + "\n");
+ }
+ bw.flush();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }