Pergunta

I am having issues with rendering next screen if Infinite Progress is used and if this piece of code is uncommented then I am able to show the next screen where it displays a list.

    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);
Foi útil?

Solução

You have a race condition between disposing the infinite progress and the showing of the next form. Move the dialog showing code before

ConnectionRequest request = new ConnectionRequest() 

Then

            dlg.dispose();
           //Get a sorted List from the response and use it to fill the list
           poList.show();
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top