Created
March 2, 2016 09:53
-
-
Save codenameone/f7e2f95e5beb11901e1c to your computer and use it in GitHub Desktop.
Sample of overriding the ConnectionRequest callback methods in Codename One
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample usage of ConnectionRequest.
From the Codename One project