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


Intel SE7520JR2  Server Board FOR XEON PROCESSOR W/ BOX picture

Intel SE7520JR2 Server Board FOR XEON PROCESSOR W/ BOX

$150.00



INTEL XEON E5 2520V2 E5 2620V2 SR1AN 2.10 GHZ Core Processor 3401A832 picture

INTEL XEON E5 2520V2 E5 2620V2 SR1AN 2.10 GHZ Core Processor 3401A832

$12.00



Intel SE7501WV2 SCSI Server Board FOR XEON PROCESSOR W/ BOX picture

Intel SE7501WV2 SCSI Server Board FOR XEON PROCESSOR W/ BOX

$150.00



Intel SE7500WV2 SCSI Server Board FOR XEON PROCESSOR W/ BOX picture

Intel SE7500WV2 SCSI Server Board FOR XEON PROCESSOR W/ BOX

$150.00



NETWORK INSTRUMENT GIGASTOR- 2U (2X) XEON E5-2630- 64 GB PC3 RAM picture

NETWORK INSTRUMENT GIGASTOR- 2U (2X) XEON E5-2630- 64 GB PC3 RAM

$293.99



Trenton 92-506313-XXX W/ 2x Intel Xeon Processors & 4GB DDR2 RAM picture

Trenton 92-506313-XXX W/ 2x Intel Xeon Processors & 4GB DDR2 RAM

$110.00







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