BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 12-23-2010, 03:42 AM   #1
levanphong7887
New Member
 
Join Date: Oct 2010
Model: 9650
PIN: N/A
Carrier: Developer
Posts: 14
Default Dialog.ask() don't work ?

Please Login to Remove!

Hi all,


I have invoked Dialog.ask(Dialog.D_YES_NO, "text") in class A that extern Thread class.

I have debuged and it have run to this line but the Dialog not occur and my program is suspended.


but Dialog.ask(Dialog.D_YES_NO, "text") work fine when It was invoked in the class that extern MainScreen class.


any suggesstion, thanks !
Offline  
Old 12-23-2010, 08:45 AM   #2
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Default Re: Dialog.ask() don't work ?

You cannot access the UI from a non-event thread.

You either need to pass this work off to the event thread, or acquire the event lock.

See UiApplication.invokeLater() for a clue. You can place the dialog in a Runnable class, then pass to invokeLater().
Offline  
Old 12-24-2010, 12:04 AM   #3
levanphong7887
New Member
 
Join Date: Oct 2010
Model: 9650
PIN: N/A
Carrier: Developer
Posts: 14
Default Re: Dialog.ask() don't work ?

Quote:
Originally Posted by Dougsg38p View Post
You cannot access the UI from a non-event thread.

You either need to pass this work off to the event thread, or acquire the event lock.

See UiApplication.invokeLater() for a clue. You can place the dialog in a Runnable class, then pass to invokeLater().
Thanks, your way make it run fine.
But when I debug i encourage another problem with UiApplication.invokeLater().

here my code:

Code:
(1) if(var == 0)
{
UiApplication.getUiApplication().invokeLater(new Runnable() 
{
	public void run() 
	{
(2)UiApplication.getUiApplication().pushScreen(Global.displayImageScreen);
	 }
	});
}
I have inserted break point into (1) and (2), but when I debug, it always jump to (2) first without check the condition if(var == 0). I don't understand, please help me, thanks !
Offline  
Old 01-14-2011, 02:05 PM   #4
hrbuckley
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Default Re: Dialog.ask() don't work ?

Are you developing with the JDE or Eclipse?

I don't understand why execution is not stopping at break point 1, but obviously it is getting there, and var == 0 or the code with break point 2 would not be executed.

On reason could be that break point 1 would be executed on one thread, and break point 2 would be executed on a different thread, the event thread. If break points are somehow disabled for the thread that is executing the code a break point 1 then you would get the behaviour you are seeing.
__________________
My other Blackberry is a PlayBook.
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

Similar Threads for: Dialog.ask() don't work ?
Thread Thread Starter Forum Replies Last Post
HOWTO: Use BlackBerry on Generic NON-BlackBerry Data Plan Mark Rejhon BlackBerry Network 95 05-20-2018 07:58 AM
Work Email Restriction Issues? ricpac General BlackBerry Discussion 2 12-13-2007 10:23 AM
webmail on BIS fine, work email not ahw01 General BlackBerry Discussion 1 11-05-2007 12:57 PM
Blackberry Work in Korea? wangta01 General BlackBerry Discussion 10 09-27-2006 08:55 AM
Help Home address and Work address fabius Developer Forum 2 09-26-2006 05:52 AM


Automation Direct Potentiometer Part No. ECX2300-10K picture

Automation Direct Potentiometer Part No. ECX2300-10K

$30.00



Takeuchi Potentiometer 1911514843 picture

Takeuchi Potentiometer 1911514843

$81.42



Dynapac Potentiometer Kit 4812158159 picture

Dynapac Potentiometer Kit 4812158159

$731.98



Potentiometer ASS'Y Knob 22U-06-22420 For Komatsu PC220LC-7 PC360-7 Excavator picture

Potentiometer ASS'Y Knob 22U-06-22420 For Komatsu PC220LC-7 PC360-7 Excavator

$49.00



10 turn Potentiometer 3590S Wirewound Variable Resistor Precision multi-turn POT picture

10 turn Potentiometer 3590S Wirewound Variable Resistor Precision multi-turn POT

$46.45



US Stock 10 Units 100K B100K OHM Linear Taper Rotary Potentiometer POT Red Knob picture

US Stock 10 Units 100K B100K OHM Linear Taper Rotary Potentiometer POT Red Knob

$9.49







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