BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 04-11-2008, 06:59 AM   #1 (permalink)
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question Problem while trying to close a popup dialog

Please Login to Remove!

when i am trying to close a screen which extends popupScreen from an event thread i am getting this exception

java.lang.IllegalStateException: UI engine accessed without holding the event lock.

Last edited by arunk : 04-11-2008 at 07:16 AM.
Offline  
Old 04-11-2008, 08:56 AM   #2 (permalink)
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Code:
invokeLater(new Runnable(){ public void run() { } });
(and don't forget to press strg+shift+f in eclipse after inserting ;) )
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 04-13-2008, 11:45 PM   #3 (permalink)
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
Post Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up

I tried that and also like:

Code:
UiApplication.getUiApplication().invokeLater(new Runnable()
{
      public void run()
     {
           synchronized(UiApplication.getEventLock()){
                 onDemandDialog.close();
           }
     }
});
but i am getting an exception like

IllegalStateException : UI engine accessed without holding the event lock
Offline  
Old 04-13-2008, 11:51 PM   #4 (permalink)
Thumbs Must Hurt
 
Join Date: Mar 2008
Model: 8820
PIN: N/A
Carrier: Airtel
Posts: 51
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Let me know how r u showing the screen i.e., using pushscreen or what..??

Can you post ur code, so i can clarify ur doubt soon.
Offline  
Old 04-14-2008, 12:01 AM   #5 (permalink)
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am declaring the class as:

private final class OnDemandDialog extends PopupScreen {
...............
}

I am pushing the screen like this:

Code:
   onDemandDialog=new OnDemandDialog();
   //this.onDemandDialog=onDemandDialog;
   UiApplication.getUiApplication().pushScreen(onDemandDialog);

inside callIncoming event

Code:
UiApplication.getUiApplication().invokeLater(new Runnable()
{
      public void run()
      {
           synchronized(UiApplication.getEventLock()){
                  onDemandDialog.close();
           }
      }
});

then i am getting that exception
Offline  
Old 04-14-2008, 12:24 AM   #6 (permalink)
Thumbs Must Hurt
 
Join Date: Mar 2008
Model: 8820
PIN: N/A
Carrier: Airtel
Posts: 51
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Push the screen like below code:

Code:
public static void main(String args[]) {
        onDemandDialog=new OnDemandDialog();
        UiEngine ui = Ui.getUiEngine();
        ui.queueStatus(onDemandDialog, 1, true);
        main.enterEventDispatcher();
  }
inside callIncoming event

Remove like below:

Code:
UiEngine ui = Ui.getUiEngine();
ui.dismissStatus(onDemandDialog);
You can use some listener to get status after the dialog has been closed.
"DialogClosedListener"
Offline  
Old 04-14-2008, 02:54 AM   #7 (permalink)
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

but main.enterEventDispatcher();

is trowing an exception like already one Event dispatcher is running.....
Offline  
Old 04-14-2008, 03:55 AM   #8 (permalink)
Thumbs Must Hurt
 
Join Date: Mar 2008
Model: 8820
PIN: N/A
Carrier: Airtel
Posts: 51
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok.

Remove the dispactcher in the above code and try.
Offline  
Old 04-14-2008, 04:54 AM   #9 (permalink)
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I tried like:

UiEngine ui = Ui.getUiEngine();
ui.pushGlobalScreen(onDemandDialog, 1, true);

(queueStatus is deprecated)
to push the screen and

UiEngine ui = Ui.getUiEngine();
ui.popScreen(onDemandDialog);
(dismissStatus is deprecated)

to pop the screen

but getting an exception like:

java.lang.IllegalArgumentException: popScreen: UiEngine is net.rim.device.api.ui.UiEngineImpl@94afa3c6 != net.rim.device.api.ui.UiEngineImpl@b109e82c
Offline  
Old 04-14-2008, 06:11 AM   #10 (permalink)
Thumbs Must Hurt
 
Join Date: Mar 2008
Model: 8820
PIN: N/A
Carrier: Airtel
Posts: 51
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Code:
ui.pushGlobalScreen(onDemandDialog, 1, UiEngine.GLOBAL_MODAL);
use this code for pushing the screen.

I am not getting exception, i have two r more screen and it is working well.

Try to debug where r u doin mistake.

Regards,
hithayath.
Offline  
Old 04-14-2008, 06:29 AM   #11 (permalink)
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

this code i tried and its pushing the screen properly, but exception happens when i pop the screen....

Last edited by arunk : 04-14-2008 at 06:48 AM.
Offline  
Old 04-14-2008, 07:26 AM   #12 (permalink)
Thumbs Must Hurt
 
Join Date: Mar 2008
Model: 8820
PIN: N/A
Carrier: Airtel
Posts: 51
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Post your full code, so that i can give a try.
Offline  
Old 04-14-2008, 07:50 AM   #13 (permalink)
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

its a big application with many files interconnected...


can you please try creating a class myScreen which extends main screen, and implements Phonelistener.

then inside that class, another class named ondemand, which extends popup screen which contains two radiobuttons inside a radiobuttonGroup.

then you open the main screen and from that the popup screen.

when you get an incoming call if popup screen(onDemand) is open just close it....

can you please try this and tell me whether its working properly???

Last edited by arunk : 04-14-2008 at 07:52 AM.
Offline  
Old 04-15-2008, 02:25 AM   #14 (permalink)
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

I found a solution.. I dont know whether its the proper way to do that..
But thats the only way i can close that popupScreen without any exceptions...


What i did is

In the OnDemandDialog class i added an onExposed() method and inside that i wrote the code to close the popupScreen


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.