BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 11-01-2010, 04:01 PM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2010
Model: 8530
PIN: N/A
Carrier: Sprint
Posts: 48
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Changing the timeinterval in invokeLater() method

Please Login to Remove!

Setting true for repeat parameter, the invokeLater() method continually re-adds the runnable object to the event queue, pausing the time (in my case, 10 sec) between each insertion.

Code:
public static int timeInterval=10000;

UiApplication.getUiApplication().invokeLater(new Runnable() {
			public void run() {
				//code to print the list
			}
		}, timeInterval, true);
Now I need to change the timeInterval dynamically while running the application. Changes in global variable 'timeInterval' doesnot effect its execution because time is already set before executing the thread.

So, I think I need to kill the thread and restart again with new timeInterval. Is this the way to solve it ? What will be the good solution for this?

Romah

Last edited by romah : 11-01-2010 at 04:06 PM.
Offline  
Old 11-01-2010, 05:11 PM   #2 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2010
Model: 8530
PIN: N/A
Carrier: Sprint
Posts: 48
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I tried using cancelInvokeLater() . It displays the list in old timeInterval.

Code:
public static int timeInterval=10000;

private void callTimer()
{
int runnableID = UiApplication.getUiApplication().invokeLater(new Runnable() {
			public void run() {

				//code to print the list

			}
		}, timeInterval, true);
}

timeInterval=30000;

UiApplication.getUiApplication().cancelInvokeLater(runnableID);

callTimer();
Any idea please ?

Last edited by romah : 11-01-2010 at 05:12 PM.
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

M328 Multi-functional LCD Backlight Transistor Tester Diode Thyristor Capacitanc
$47.49
M328 Multi-functional LCD Backlight Transistor Tester Diode Thyristor Capacitanc picture2N4442 Motorola Silicon Controlled Rectifier SCR Thyristor Transistor NOS Qty 1
$4.49
2N4442 Motorola Silicon Controlled Rectifier SCR Thyristor Transistor NOS Qty 1 picture(4) PRX USA Thyristor Semiconductor PP602 150 (3) NEW (1) USED
$89.99
(4) PRX USA Thyristor Semiconductor PP602 150 (3) NEW (1) USED  pictureGENTRON B512F-2 THYRISTOR MODULE *NEW NO BOX*
$46.0
GENTRON B512F-2 THYRISTOR MODULE *NEW NO BOX* picture48-83741C03 Transistor SCR Rectifier Thyristor Motorola - NOS Vintage Qty 2
$24.99
48-83741C03 Transistor SCR Rectifier Thyristor Motorola - NOS Vintage Qty 2  picture






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