BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 12-23-2009, 03:50 PM   #1 (permalink)
New Member
 
Join Date: Jul 2009
Model: 9530
PIN: N/A
Carrier: Nokia
Posts: 7
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default How to get rid of pre loader in UI threads

Please Login to Remove!

Hello All

I am doing something like below to update the label field for every second in run method of my thread class. But problem is application displays pre loader/hour glass for every update. I want to get rid of that hour glass and I want to see smooth update of the label field to be happened. How can I do that

public void run()
{
while(true)
{
Thread.sleep(1000);
setRecordingTime(new Date().getTime());
}
}

private void setRecordingTime(long maxRecordTime) {
synchronized (UiApplication.getEventLock()) {

label.setText(getFormatted(maxRecordTime));

}
}

Thanks
Sudhakar Chavali
Offline  
Old 12-23-2009, 06:02 PM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

I would ditch the getEventLock() and try to use invokeLater() instead.
Offline  
Old 12-24-2009, 04:34 AM   #3 (permalink)
New Member
 
Join Date: Jul 2009
Model: 9530
PIN: N/A
Carrier: Nokia
Posts: 7
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Tried with that also. Endup with same problem
Offline  
Old 12-24-2009, 07:27 AM   #4 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

How are you creating/starting the thread?
Offline  
Old 12-24-2009, 08:43 AM   #5 (permalink)
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
Default

Are you creating lots of objects that go out of scope in your work cycle? If you are you could be stimulating the garbage collector.
__________________
My other Blackberry is a PlayBook.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.