BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 11-01-2010, 04:01 PM   #1
romah
Knows Where the Search Button Is
 
Join Date: Jun 2010
Model: 8530
PIN: N/A
Carrier: Sprint
Posts: 48
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
romah
Knows Where the Search Button Is
 
Join Date: Jun 2010
Model: 8530
PIN: N/A
Carrier: Sprint
Posts: 48
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



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


USA Windows VPS Server / RDP Server / VPS Hosting 12GB RAM + 400GB HDD picture

USA Windows VPS Server / RDP Server / VPS Hosting 12GB RAM + 400GB HDD

$27.99



USA Windows VPS RDP Server/ Windows VPS Hosting - 4GB RAM + 150GB HDD picture

USA Windows VPS RDP Server/ Windows VPS Hosting - 4GB RAM + 150GB HDD

$11.99



USA Windows VPS RDP Server/ Windows VPS Hosting - 4GB RAM + 150GB HDD -  1 Year picture

USA Windows VPS RDP Server/ Windows VPS Hosting - 4GB RAM + 150GB HDD - 1 Year

$129.88



Vollrath 72050 Cayenne 28 3/4

Vollrath 72050 Cayenne 28 3/4" x 13 3/4" Heat 'n Serve 4/3 Size Countertop Food

$285.00



Hubbell NXBTC NX Bluetooth Radio Module with Time Server -  picture

Hubbell NXBTC NX Bluetooth Radio Module with Time Server -

$129.99



Wti Console Server + PDU CPM-800-1-EA picture

Wti Console Server + PDU CPM-800-1-EA

$550.00







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