×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jul 2013
    Posts
    16

    Asha SDK 1.0. Append loader before request

    I want to display an animation (loader) before execute request to web server. Im using LCDUI's Form class, my code looks like that
    Code:
    deleteAll();
    appendLoader();
    executeRequest();
    appendReceivedData();
    But loader appears only after request is executed. I tried to debug it
    Code:
    deleteAll();
    appendLoader();
    System.out.println("size: "+size());
    executeRequest();
    appendReceivedData();
    It outputs "size: 1" before request is pending, but form still is empty on my screen.

    How can I solve this problem? Is there another method to display loader?
    Thanks.

  2. #2
    Registered User
    Join Date
    Jul 2013
    Posts
    16

    Re: Asha SDK 1.0. Append loader before request

    Solved problem using multithreading.

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,740

    Re: Asha SDK 1.0. Append loader before request

    Many (most?) UI frameworks use a single thread for dealing with events, one by one. In this context tapping the screen, issuing a command are events, and requesting to display a new UI element, or redrawing the screen are also events. So the new UI element(s) will not get drawn until the current event handler returns. Which, in this case, happens a lot later, when the entire request is issued and the result is handled.
    Solution step 1: you should move executeRequest() and appendReceivedData() calls into a new thread.
    Here comes an issue, UI elements may not tolerate well if they are used from other threads (than the UI thread). Thus this kind of UI frameworks provide some way to "post" instructions to be executed in the UI thread. LCDUI has http://docs.oracle.com/javame/config...lang.Runnable) for this purpose.
    Solution step 2: wrap appendReceivedData() call into a Runnable and pass it to Display.callSerially.

  4. #4
    Registered User
    Join Date
    Jul 2013
    Posts
    16

    Re: Asha SDK 1.0. Append loader before request

    Thanks a lot. Understood it a bit later

Similar Threads

  1. Mail for exchange for nokia Asha 210 dual sim и Asha 501 dual sim
    By ttipsy in forum General Development Questions
    Replies: 2
    Last Post: 2013-07-26, 16:21
  2. Replies: 3
    Last Post: 2013-05-19, 11:29
  3. TPtr8 with append (0x00) +append(0x01)
    By mariosas in forum Symbian
    Replies: 2
    Last Post: 2007-03-28, 07:46

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×