We had some issues with getting timeout to work on LWUIT. It should be working with Codename One although on J2ME it would be "faked" regardless since J2ME doesn't allow for timeout so we essentially kill the whole thread.
Lwuit Network Connection Timeout issue
-
02-06-2022 - |
Question
Sorry for my bad English.
I have download an image from network, i set timeout 2000 milisecond, but timeout not work. This is my code
public void actionPerformed(ActionEvent evt) {
if (evt.getSource() == okCommand) {
final Form resultForm = new Form("Result");
resultForm.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
resultForm.show();
Label mLabel = new Label();
ImageDownloadService img = new ImageDownloadService("http://datastore04.rediff.com/h1500-w1500/thumb/69586A645B6D2A2E3131/s47kscdm7r4pjx05.D.0.Happy-Valentines-Day-Wallpaper-Image.jpg", mLabel);
img.setTimeout(2000);
NetworkManager.getInstance().addToQueue(img);
resultForm.addComponent(mLabel);
Progress progress = new Progress("Loading", img);
progress.setDisposeOnCompletion(true);
progress.show();
}
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow