【问题标题】:BlackBerry - Uncaught exception: Application is not responding; process terminated黑莓 - 未捕获的异常:应用程序没有响应;进程终止
【发布时间】:2010-12-07 11:34:08
【问题描述】:

我正在使用适用于 Eclipse 的 Blackberry 插件开发应用程序,当我将应用程序部署到生产服务器和手机时调用 Web 服务时出现以下错误...它在我的本地工作模拟器和开发环境。 (我无法将我的模拟器直接挂接到我的生产环境)

未捕获的异常:应用程序 app(150) 没有响应;过程 终止

正在从另一个线程进行调用。

线程被传递给我的CustomThreadManager运行

ClientChangeThread thread = new ClientChangeThread();
CustomThreadManager.Start(thread, true);

自定义线程管理器

ProgressPopup _progress = null; 
    if(showProgress){
        _progress = new ProgressPopup("Loading...");
        _progress.Open();
    }
    thread.start();             

    while (thread.isRunning())
    {
        try
        {
            CustomThread.sleep(300);
            if(showProgress){
                _progress.doPaint();
            }
        }
        catch (InterruptedException e)
        {
            Dialog.alert("Error contacting webservice\n" + e.getMessage());
            Functions.moveBack();
        }                   
    }
    if(showProgress)
        _progress.Close();

有些调用有效,有些则无效。 Web 服务返回结果相当快,所以我不确定 Web 服务是否太慢或线程有问题。

任何帮助表示赞赏。

【问题讨论】:

    标签: blackberry blackberry-eclipse-plugin


    【解决方案1】:

    Thread.sleep() 不会释放任何锁。这意味着您在 while 循环中更新进度条的代码持有 UI 事件锁,并防止其他 UI 更新发生,直到 while 循环终止——在这种情况下,当 thread.isRunning() 返回 false 时。

    您可以使用UiApplication.invokeLater(Runnable, long, boolean) 安排重复的 UI 更新,该更新只会在 Runnable 执行时持有事件锁。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-20
      • 2023-03-11
      相关资源
      最近更新 更多