×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Feb 2013
    Posts
    41

    Unhappy LWUIT list does not get redrawn automatically if the underlying ListModel changes

    Hello Experts!

    I am in need of your help once again! I have a list and a custom list model. The data in my list model is loaded on a separate thread in order to improve the responsiveness of the list. This makes the data come down in trickles as it tries to fetch it from the database. I have DataChangedListener installed and so whenever new data comes into the model, I call <listener>.dataChanged(DataChangedListner.ADDED, idx). However, the list does not get redrawn automatically as new items are added but if I scroll on the list, it gets redrawn and the new data from the model gets shown on the list.

    So the question is, should the list refresh be handled by my code manually every time the model changes? If so, what is the best way to do this? Setting the model again seemed to work (i.e. list.setModel(model)) as well as repainting the list but I am not sure if that is the right way of doing it as it sometimes does not resize the list to the correct size.

    Many many thanks!
    Jim

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,750

    Re: LWUIT list does not get redrawn automatically if the underlying ListModel changes

    Threading is the key. Mobile UI frameworks usually do not support direct access from secondary threads.
    LWUIT has callSerially/AndWait methods in Display, there you can specify a Runnable which will be executed in the LWUIT UI thread (EDT=Event Dispatch Thread). You can use Display.getInstance even in secondary threads.
    For completeness, in LCDUI there is also a callSerially method of Display for this purpose, and Display.getDisplay.
    Also for completeness: EDT and LCDUI's UI thread are two different threads.

  3. #3
    Registered User
    Join Date
    Feb 2013
    Posts
    41

    Re: LWUIT list does not get redrawn automatically if the underlying ListModel changes

    Of course! I completely forgot about that!

    Many Thanks!

Similar Threads

  1. Add list after showing form (hack for lwuit s40 list bug)
    By xuanphung001 in forum Mobile Java General
    Replies: 2
    Last Post: 2013-04-24, 03:15
  2. How to append LWUIT List screen to a LWUIT Form in j2me?
    By pavanragi in forum Mobile Java General
    Replies: 1
    Last Post: 2012-08-06, 07:01
  3. lwuit list +sub list its need to show sub list
    By babu7575 in forum Mobile Java General
    Replies: 0
    Last Post: 2011-04-04, 14:12
  4. LWUIT List
    By HasithaRandika in forum Mobile Java General
    Replies: 1
    Last Post: 2009-02-26, 10:32
  5. Edwin not redrawn
    By AcroDesign in forum Symbian User Interface
    Replies: 2
    Last Post: 2006-01-27, 00:06

Posting Permissions

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