I copied the web service example on this page:
http://www.codenameone.com/how-do-i.html exactly.
It works, but in my postResponse, I have showForm instead of updating a component, thusly:
ConnectionRequest con = new ConnectionRequest() {
Hashtable json;
@Override
protected void postResponse(){
name = json.get("firstName").toString();
if (name != null && !"".equals(name)) {
System.out.println("about to show main form");
showForm("MainForm", null);
}
}
@Override
protected void readResponse(InputStream input) throws IOException {
JSONParser p = new JSONParser();
json = p.parse(new InputStreamReader(input));
System.out.println("" + json);
};
};
con.setPost(false);
con.setUrl(URL + "/login");
con.addArgument("user", card);
con.addArgument("pass", pin);
InfiniteProgress prog = new InfiniteProgress();
Dialog dlg = prog.showInifiniteBlocking();
con.setDisposeOnCompletion(dlg);
The problem is, it flashes up MainForm, then immediately goes back tot he login form.
If I do the ShowForm directly from the button action call, it works.
Im using side menu style if that has any bearing, and the login form (which is the initial form) has no command etc.
Any ideas?