【问题标题】:Lwuit Network Connection Timeout issueLwuit 网络连接超时问题
【发布时间】:2013-07-02 03:36:03
【问题描述】:

对不起,我的英语不好。

我从网络下载了一张图片,我设置了超时 2000 毫秒,但超时不起作用。 这是我的代码

    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();
    }

【问题讨论】:

  • 可能是您的连接速度较慢,尝试使用 40 秒的超时时间
  • 我尝试 2 秒,0.5 秒超时,但它不起作用
  • 我是说要增加超时时间,而你正在减少它,试试img.setTimeout(40000);
  • 我的意思是超时不起作用
  • 那么可能是另一个问题,做一件事,把你的代码放在try-catch块中,看看有没有运行时错误

标签: networking java-me timeout lwuit


【解决方案1】:

我们在处理 LWUIT 时遇到了一些问题。它应该与 Codename One 一起工作,尽管在 J2ME 上它会被“伪造”,因为 J2ME 不允许超时,所以我们基本上杀死了整个线程。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-04
    • 2011-07-24
    • 2019-02-07
    • 2016-03-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多