BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 04-11-2008, 06:59 AM   #1
arunk
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
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
simon.hain
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
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
arunk
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
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
hithayath_sait
Thumbs Must Hurt
 
Join Date: Mar 2008
Model: 8820
PIN: N/A
Carrier: Airtel
Posts: 51
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
arunk
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
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
hithayath_sait
Thumbs Must Hurt
 
Join Date: Mar 2008
Model: 8820
PIN: N/A
Carrier: Airtel
Posts: 51
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
arunk
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
Default

but main.enterEventDispatcher();

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

Ok.

Remove the dispactcher in the above code and try.
Offline  
Old 04-14-2008, 04:54 AM   #9
arunk
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
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
hithayath_sait
Thumbs Must Hurt
 
Join Date: Mar 2008
Model: 8820
PIN: N/A
Carrier: Airtel
Posts: 51
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
arunk
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
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
hithayath_sait
Thumbs Must Hurt
 
Join Date: Mar 2008
Model: 8820
PIN: N/A
Carrier: Airtel
Posts: 51
Default

Post your full code, so that i can give a try.
Offline  
Old 04-14-2008, 07:50 AM   #13
arunk
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
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
arunk
Talking BlackBerry Encyclopedia
 
arunk's Avatar
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Airtel
Posts: 229
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



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


IBM Genuine OEM Printer Filler Wide Credit Card Holder 10N1259 picture

IBM Genuine OEM Printer Filler Wide Credit Card Holder 10N1259

$24.79



Lot of 2 IBM Correctable Ribbon Cassette Black 1299300 NOS Original OEM picture

Lot of 2 IBM Correctable Ribbon Cassette Black 1299300 NOS Original OEM

$12.00



IBM CASH DRAWER KEY'S #9960 SET OF 2 KEYS. AFTERMARKET KEY'S SAME AS OEM 33G3360 picture

IBM CASH DRAWER KEY'S #9960 SET OF 2 KEYS. AFTERMARKET KEY'S SAME AS OEM 33G3360

$18.00



New 2 Sets of 2 (4) keys total OEM 9952 IBM Keys for Cash Drawers Displays Locks picture

New 2 Sets of 2 (4) keys total OEM 9952 IBM Keys for Cash Drawers Displays Locks

$14.99



OEM  IBM Type 5441 WheelWriter 3 1356658 1362400-02 Main Boards Tested Working picture

OEM IBM Type 5441 WheelWriter 3 1356658 1362400-02 Main Boards Tested Working

$49.99



NEW Genuine OEM IBM Quietwriter Hi Density Correcting Ribbon 1299635 NOS picture

NEW Genuine OEM IBM Quietwriter Hi Density Correcting Ribbon 1299635 NOS

$19.99







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