BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 09-13-2008, 06:03 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Oct 2007
Model: 7100i
PIN: N/A
Carrier: Dont know
Posts: 195
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default UI getting locked

Please Login to Remove!

hi


in my application i first show a screen (this screen contains a loading Text in the paint method eg. Loading... like in gmail app) and a button. When i click the button i run a thread and retireves data from the server. Now to give UI responsive i run another thread which will keep on updating the Loading. text like this Loading. Loading.. Loading... , but the problem is the screen gets locked and in the screen the Loading is never updated as i wanted.

Iam confused since i am running the thread to update the text in the screen but the screen is still locked. Does anyone know what may be the problem.

Thanks
Offline  
Old 09-13-2008, 09:22 AM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: Apr 2008
Model: 8130
PIN: N/A
Carrier: US Cellular
Posts: 82
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Instead of using a thread to refresh the UI, try a timer in your main thread. See Timer and TimerTask. Also, how are you waiting in your threads? Hopefully you're sleeping or waiting, and not just making busy loops.
Offline  
Old 09-14-2008, 02:04 PM   #3 (permalink)
Thumbs Must Hurt
 
Join Date: Apr 2006
Location: Boston
Model: 8900
Carrier: AT&T
Posts: 98
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi!

You may also want to keep in mind that the main-event thread is the only thread that's allowed to make modifications to UI stuff on the screen. A background thread - including a TimerTask - is not the main-event thread, so any changes you make to the UI will not appear at the execution of the statement, unless you put the code that will modify the UI into yet another thread, like the following:

Code:
UiApplication.getUiApplication().invokeLater( new Runnable()
{
    public void run()
    {
        // modify the UI
    }
});
Cheers,

karl
__________________
Karl G. Kowalski
---------------
Owns a RAZR
Develops for BlackBerry
So next phone will be........an iPhone 3G!
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.