BlackBerry - Uncaught exception: Application is not responding; process terminated

感情迁移 提交于 2020-01-06 15:18:58

问题


I'm developing an application using the Blackberry plugin for eclipse and I am getting the following error when making a call to a web service when I have deployed my application to a production server and handset... it works in my local simulator and development environment. (I can't hook my simulator directly to my production environment)

Uncaught exception: Application app(150) is not responding; process terminated

The call is being made from another thread.

The thread is passed to my CustomThreadManager to run

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

CustomThreadManager

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

Some calls work while others dont. The web service returns results fairly quickly so Im not sure if its the web service is too slow or problems with the threading.

Any help appreciated.


回答1:


Thread.sleep() does not release any locks. This means your code to update the progress bar in the while-loop is holding the UI event lock, and prevents other UI updates from happening until the while loop terminates -- in this case when thread.isRunning() returns false.

You can use UiApplication.invokeLater(Runnable, long, boolean) to schedule a repeating UI update that will only hold the event lock while the Runnable is executing.



来源:https://stackoverflow.com/questions/4376140/blackberry-uncaught-exception-application-is-not-responding-process-terminat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!