the below code (using slow network connection) makes the simulator and 
android tablet dim, but the spinner never shows

        public void onbtnLoginCommand(com.codename1.ui.events.ActionEvent ev
, Command cmd) {
// show a wait dialog
InfiniteProgress prog = new InfiniteProgress();
Dialog dlg = prog.showInifiniteBlocking();
dlg.setTitle("Logging On");
login();

dlg.dispose();
}

protected void login() {
ConnectionRequest r = new ConnectionRequest() {
@Override
protected void readResponse(InputStream input) throws IOException {
json = new JSONParser().parseJSON(new InputStreamReader(input));
}
@Override
protected void postResponse() {
MessageBox.OK("yay", "it worked");
}
};
r.setUrl(GLOBALS.BASEURL + "/validateLogin");
r.setPost(true);
r.addArgument("user", gui_Text_Field_UserName.getText());
r.addArgument("password", gui_Text_Field_Password.getText());
NetworkManager.getInstance().addToQueueAndWait(r);
}
protected void loadCurrentActivity() {
ConnectionRequest r = new ConnectionRequest() {
@Override
protected void readResponse(InputStream input) throws IOException {
// parse it
}
@Override
protected void postResponse() {
//display it
}
};
r.setUrl(GLOBALS.BASEURL + "/getCurrentActivity");
r.setPost(true);
r.addArgument("hash", GLOBALS.employee.getPassword());
NetworkManager.getInstance().addToQueueAndWait(r);
}
protected void loadStats() {
ConnectionRequest r = new ConnectionRequest() {
@Override
protected void readResponse(InputStream input) throws IOException {
// parse it
}
@Override
protected void postResponse() {
//display it
}
};
r.setUrl(GLOBALS.BASEURL + "/getStats");
r.setPost(true);
r.addArgument("hash", GLOBALS.employee.getPassword());
NetworkManager.getInstance().addToQueueAndWait(r);
}

Also if I need to then do a sequence of network calls, what is the best way 
to handle that?  onbtnLoginCommand is in the EDT as is postResponse().  do 
I just chain them all together in subsequent readResponse()?  Where do I 
call loadCurrentActivity and loadStats()?

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/97a9f498-2413-4bd3-90b1-2c78d14dbc1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to