在Simulator中测试我的应用程序时,我的应用运行完美。但是在真实设备上我得到BasicEditField的 Null ,所以我无法执行我的应用程序。以下是我的代码段。
public class Login extends MainScreen {
private UiApplication application = UiApplication.getUiApplication();
private BasicEditField _email = null;
private PasswordEditField _pwd = null;
private ButtonField login = null;
String imei = GPRSInfo.imeiToString(GPRSInfo.getIMEI(), false);
public Login(){
try {
_email = new BasicEditField("Email: ", "", 100, EditField.NO_NEWLINE);
_email.setFont(font);
add(_email);
_pwd = new PasswordEditField("Password: ", "", 100, EditField.NO_NEWLINE);
_pwd.setFont(font);
add(_pwd);
login = new ButtonField("Login", ButtonField.CONSUME_CLICK);
login.setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
String e = _email.getText();
String xmlUrl = "http://********:9090/com.infra.rest/rest/todo?email='"+ e +"'&dId='"+ imei +"';deviceside=true";
String[][] urlData = XmlFunctions.getUserFromXml(xmlUrl);
}
});
login.setFont(font);
add(login);
} catch (Exception e) {
System.out.println("Failed to create user interface components");
}
}
}
在检查电子邮件和imei值时,我得到 NULL ,并且说明方法“toString”并带有签名“()Ljava / lang / String;”不适用于此对象
已经整整一天但我无法克服这个问题。
答案 0 :(得分:1)