CodeNameOne InfiniteProgress问题

时间:2014-02-17 22:08:57

标签: infinite codenameone

如果使用无限进度,我在渲染下一个屏幕时遇到问题,如果这条代码被取消注释,那么我可以显示下一个显示列表的屏幕。

    final Form poList = (Form) super.createContainer(getResourceFilePath(), "POList");
    ConnectionRequest request = new ConnectionRequest() 
{
    Hashtable response = null;

        protected void readResponse(InputStream input) 
        {
                //Read and parse the response
        }

        protected void postResponse() 
        {
            if (response != null) 
            {
                try
                {
               //Get a sorted List from the response and use it to fill the list
                        poList.show();
                }
                catch(Exception e)
                {
                    e.printStackTrace();
                }
            }               
        }
    };

    request.setUrl(poListUrl);
    request.setPost(false);
    request.addRequestHeader("Authorization","Bearer "+accessToken);
    request.setContentType("text/xml");

            /*
            If these three lines are commented then the next form is shown properly
            */
    InfiniteProgress ip = new InfiniteProgress();
    Dialog dlg = ip.showInifiniteBlocking();
    request.setDisposeOnCompletion(dlg);

    NetworkManager.getInstance().addToQueue(request);

1 个答案:

答案 0 :(得分:0)

在处理无限进度和显示下一个表单之间存在竞争条件。 移动显示代码的对话框

ConnectionRequest request = new ConnectionRequest() 

然后

            dlg.dispose();
           //Get a sorted List from the response and use it to fill the list
           poList.show();