Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Posts: 63
Registered: ‎08-07-2009
My Device: Not Specified

Object List Field - view and paint - separate threads

Hi, I am wondering if someone could offer me a pointer in the right direction, i'm inserting rows of the olf 3 times before i show it on screen, it keeps loading but i ve found this is the best way other than having the user sit there for 40 secs waiting for app to load data when they could be viewing what's already there now. I want to somehow get the rows painting in a seperate thread so that i can scroll whilst loading. Currently i can't scroll for periods of about 5 secs every 5 secs whilst loading. 

I insert row like so..


public  void insertRow()
 synchronized (UiApplication.getApplication().getEventLock())
 OLF.insert(i, new Person(Id,  name));


I am a little confused so please forgive a new prgrammer!





BlackBerry Development Advisor
Posts: 15,784
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Object List Field - view and paint - separate threads

Synchronizing with the event lock in this manor interrupts what it is doing to execute your insert, which means you can interrupt a user interacting with the application.  I recommend implementing the approach below.


How to - Update a screen on the Main Event Thread
Article Number: DB-00136


Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker