BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 12-23-2010, 03:42 AM   #1 (permalink)
New Member
 
Join Date: Oct 2010
Model: 9650
PIN: N/A
Carrier: Developer
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
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 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
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 (permalink)
New Member
 
Join Date: Oct 2010
Model: 9650
PIN: N/A
Carrier: Developer
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
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 (permalink)
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
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


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

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 92 03-08-2014 12:26 PM
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 09:55 AM
Help Home address and Work address fabius Developer Forum 2 09-26-2006 06:52 AM





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