我在标题中收到此错误。我从编辑文本字段创建 2 个数组列表并将它们保存在 xls 文件中。
保存:
File sdCard = Environment.getExternalStorageDirectory();
File directory = new File (sdCard, "MyFiles");
directory.mkdirs();
File file = new File(directory, filename);
FileOutputStream fos;
try {
fos = new FileOutputStream(file);
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos));
bw.write(mydata+"\t"+myweight+"\n");
bw.flush();
bw.close();
} catch (IOException e2) {
e2.printStackTrace();
}//catch
并加载:
File sdCard = Environment.getExternalStorageDirectory();
File directory = new File (sdCard, "MyFiles");
File file = new File(directory, filename);
String s;
FileInputStream fis;
try {
fis = new FileInputStream(file);
BufferedReader br = new BufferedReader(new InputStreamReader(fis));
do {
s = br.readLine();
if (s != null)
{
data.add(Double.parseDouble(s));
weight.add(Double.parseDouble(s));
}
} while (s != null);
} catch (IOException e) {
e.printStackTrace();
}
}
它在“data.add(Double.parseDouble(s));”行中显示了数字格式异常。
另外,例如,我在 2 个字段 1,10 和 2,20 中输入,文件包含一个具有 [1.0, 2.0] [1.0, 2.0] 的单元格
其他数据?以及如何将数据放在 2 列中?