Created
March 3, 2016 12:10
-
-
Save codenameone/051bfa054fd3024c8292 to your computer and use it in GitHub Desktop.
Download progress indicator using a slider 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
Form hi = new Form("Download Progress", new BorderLayout()); | |
Slider progress = new Slider(); | |
Button download = new Button("Download"); | |
download.addActionListener((e) -> { | |
ConnectionRequest cr = new ConnectionRequest("https://www.codenameone.com/img/blog/new_icon.png", false); | |
SliderBridge.bindProgress(cr, progress); | |
NetworkManager.getInstance().addToQueueAndWait(cr); | |
if(cr.getResponseCode() == 200) { | |
hi.add(BorderLayout.CENTER, new ScaleImageLabel(EncodedImage.create(cr.getResponseData()))); | |
hi.revalidate(); | |
} | |
}); | |
hi.add(BorderLayout.SOUTH, progress).add(BorderLayout.NORTH, download); | |
hi.show(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample usage of SliderBridge.
From the Codename One project