开发者

Why my file don't write text inserted?

开发者 https://www.devze.com 2023-04-11 00:28 出处:网络
I\' doing an API for Black Berry but now I have a problem, the file don\'t save text inserted , for example when I write on application running : Hello , I guess that \"Hello\" is saving in EditField

I' doing an API for Black Berry but now I have a problem, the file don't save text inserted , for example when I write on application running : Hello , I guess that "Hello" is saving in 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.开发者_如何学JAVAopenOutputStream();

    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());
}

When I check the xxx.txt only are write the Label, Nombre: but the written text in EditField isn't !! help please


Are you sure this code even compiles? I don't see where nombre is declared (even to the extend that name and pt_nombre are 'declared'); nor is there anywhere that you set a value into pt_nombre, so I don't know what you rexpect to see in the file.


you should check FixedWidthEditField getText function. will it return the text that user input

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号