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


Analog Panel AMP VOLT Current Ammeter Voltmeter Voltage Gauge 10A 50V DH-670 DC  picture

Analog Panel AMP VOLT Current Ammeter Voltmeter Voltage Gauge 10A 50V DH-670 DC

$12.99



2PCS 22mm Voltmeter Ammeter 3 in 1 Current Voltage Hertz Meters AC60-500V 0-100A picture

2PCS 22mm Voltmeter Ammeter 3 in 1 Current Voltage Hertz Meters AC60-500V 0-100A

$11.69



Mini Digital Voltmeter Ammeter DC 100V 10A Car LED Display Panel Amp Volt Tester picture

Mini Digital Voltmeter Ammeter DC 100V 10A Car LED Display Panel Amp Volt Tester

$10.49



AC 80-260V 0-100A LCD Digital Display Volt Watt Power Meter Voltmeter Ammeter picture

AC 80-260V 0-100A LCD Digital Display Volt Watt Power Meter Voltmeter Ammeter

$22.50



Digital Multimeter Voltmeter Ammeter Capacitance Volt AC DC Tester Meter+Battery picture

Digital Multimeter Voltmeter Ammeter Capacitance Volt AC DC Tester Meter+Battery

$12.95



US Stock DC 0 ~ 10A Round Analog AMP Current Pointer Needle Panel Meter Ammeter picture

US Stock DC 0 ~ 10A Round Analog AMP Current Pointer Needle Panel Meter Ammeter

$15.55







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