BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 09-12-2008, 09:04 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 Upplication.getEventLock() doubt -----taking a lot of time to update screen

Please Login to Remove!

hi

I hv a application which shows a mainScereen (mainScreen1) when the user first runs it. Then a backgroud thread also starts and retireves data from a server and then pushes another mainscreen(mainscreen2) , inside the thread i hold the application lock using the following code:

Code:
synchronized(Application.getEventLock()){     
                                UiApplication.getUiApplication().pushScreen(mainscreen2);                                
                            }
but the probelm is it takes a lot of time around 30 secs to update the screen i.e. pushing mainscreen2, while the data retrieval from the server takes only 3 seconds. Does anybody have any idea how this can be solved.


Thanks in advance.

Last edited by BB1364 : 09-12-2008 at 09:06 AM.
Offline  
Old 09-13-2008, 05:01 AM   #2 (permalink)
New Member
 
Join Date: Jan 2008
Model: 7290
PIN: N/A
Carrier: School Project
Posts: 12
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am not sure if this post helps..
Go to google and search for "Problem while trying to close a popup dialog"
It's also a post from BlackBerryForums. I couldn't post any links because I dont have enough post (must be 10 or greater).

It talks about evenlocks and etc.

In my application, I have a PIMListener that listens any add, remove, update events. Whenever my app captures a event, it writes to my screen. I dont know how long it take to update the screen since the way I tested is to go to Address Book and mess around with it to get my app captures events. However, I've never encounter the 30+ seconds waiting to be updated to screen


The below code is what I used for my app
Code:
    public static void addElementToScreen(final UiApplication uiApp, final Screen scr, final Element e){
        //uiApp.invokeLater(new UIRunnable(scr,e));
        uiApp.invokeLater(new Runnable(){
            public void run(){
                String guid = e.getAttribute("GUID");
                scr.insert(new LabelField(guid, Field.FOCUSABLE), 1);
            }
        });
    }
Offline  
Old 09-13-2008, 03:16 PM   #3 (permalink)
CrackBerry Addict
 
Join Date: May 2005
Location: Golden, CO US
Model: 9700
Carrier: ATT
Posts: 684
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try using invokeLater instead of grabbing the lock yourself.
Offline  
Old 09-15-2008, 01:10 AM   #4 (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

Does running of 3 thread one main thread and the other worker threads decrease the performance of my application to a large extent.

My app worked fine but after using the worker thread its performance decreased a lot. I used the worker thread to call data from server and update the screens of my app.

Does anyone have any ideas..

Thanks
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.