我正在做一个黑莓的API,但现在我有一个问题,该文件不保存文本插入,例如,当我在应用程序运行时写:你好,我猜这个“你好”是保存在EditField pt_nombre,为什么我的文件不能写入文本插入?
name = new LabelField("Nombre");
pt_nombre = new FixedWidthEditField();
String a = pt_nombre.getText();
String nom = name.getText();
String fullPath = "file:///SDCard/xxx.txt";
try {
FileConnection fconn = (FileConnection) Connector.open(fullPath, Connector.READ_WRITE);
if (fconn.exists()) {
fconn.delete();
}
fconn.create();
OutputStream os = fconn.openOutputStream();
os.write(nombre.getBytes());
os.write("\r\n".getBytes());
os.write(a.getBytes());
fconn.close();
} catch (IOException e) {
System.out.println("Oh noes!!1! " + e.toString());
}
当我检查xxx.txt时,只写了Label,Nombre:但EditField中的文字不是!请帮助