Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save codenameone/f7e2f95e5beb11901e1c to your computer and use it in GitHub Desktop.
Save codenameone/f7e2f95e5beb11901e1c to your computer and use it in GitHub Desktop.
Sample of overriding the ConnectionRequest callback methods in Codename One
ConnectionRequest request = new ConnectionRequest(url, false) {
protected void readResponse(InputStream input) {
// just read from the response input stream
}
protected void postResponse() {
// invoked on the EDT after processing is complete to allow the networking code
// to update the UI
}
protected void buildRequestBody(OutputStream os) {
// writes post data, by default this “just works” but if you want to write this
// manually then override this
}
};
NetworkManager.getInstance().addToQueue(request);
@codenameone
Copy link
Author

Sample usage of ConnectionRequest.

From the Codename One project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment