String strFileContent="";
Log.e(TAG, "Error loading image file names333");
StringBuilder contents = new StringBuilder();///
for (int i = 0; i < x.length; i++) {
///strFileContent += ""+x[i]+",";
contents.append(x[i]);///
contents.append(System.getProperty("line.separator"));///
}
strFileContent=contents.toString();///
String file = "scores8";
java或android: 如何从String数组x []创建一个文本文件每行一个元素???什么类型的文件使用没有ext或txt或...... ???
答案 0 :(得分:0)
String[] array = {...};
File file = new File("FilePath");
PrintWriter pw = new PrintWriter(file, true);
for(String s : array) pw.println(s);
pw.close();
答案 1 :(得分:0)
您可以在Apache Commons IO中使用FileUtils:
FileUtils.writeLines(new File("file.txt"), Arrays.asList(array));