×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    1

    Form.append() doesn't work inside a while loop

    Hi All,

    I am just trying to print some text using the Form.append()inside a while loop,
    Ex:
    while(true){
    From.append("Test");
    }

    But the append doesn't work as expected, however if i remove the loop, it works fine.

    Kindly help me to solve this issue.

    Thanks,
    Bala.

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Form.append() doesn't work inside a while loop

    The key phrase here is "as expected". What did you expect? And what does happen?

    You should never expect good things to happen when you write "while(true)".

    My guess is that you are doing this inside an event-handler method, such as startApp() or commandAction(). By looping forever, you are preventing that method from exiting. Events are serialized; that is, while one event is being handled, no other event can be delivered. Events sit in a queue, to be handled in turn.

    If you prevent an event-handler method from returning, no other events will be delivered. This includes the internal events used to update the screen. I'm guessing that you see nothing happening, until the application crashes (perhaps with an OutOfMemoryError). This is the correct behaviour.

    Event-handler methods must always return as quickly as possible. Event methods that block will cause applications to become unresponsive.

    Graham.

  3. #3
    Registered User
    Join Date
    Oct 2009
    Posts
    9

    Re: Form.append() doesn't work inside a while loop

    Execute the loop in a separate thread not in the GUI Thread.
    tony

Similar Threads

  1. Which FP1/FP" devices does Music Player Remote Control API not work on
    By kevinvernon in forum Symbian Media (Closed)
    Replies: 0
    Last Post: 2009-02-09, 12:17
  2. Replies: 1
    Last Post: 2008-11-20, 08:45
  3. open socket inside a thread
    By oyuky in forum Symbian
    Replies: 0
    Last Post: 2008-06-06, 01:07
  4. Replies: 2
    Last Post: 2008-02-22, 11:49
  5. CommConnection does not work with Series 60 SDK, but works in JWT
    By jackiechan2001 in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2004-02-04, 09:07

Posting Permissions

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