BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 02-20-2009, 04:49 PM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Jan 2009
Model: 7100T
PIN: N/A
Carrier: -
Posts: 73
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default why i cannot pause timer

Please Login to Remove!

hi,

i've got such a problem:i use timer.scheduledAtFixedRate in another thread. the problem is, that when some action happens, i must pause this timer, and when another action happens i must resume it. it looks more or less like this:


PHP Code:
public void run(){

if( 
something1 )

{

timer.scheduleAtFixedRate(TimerTasktime1time2);

}

if(
something2){

synchronized(timer){

timer.wait();

}
}

if(
something3){

timer.notify();

}


the problem is-that i cannot pause it! wait() method just does not work and i do not know why.. the only thing that works is cancel() method. but i do not want to cancel my timer i need to pause it until 'something3' happens..



Can You please suggest me anything?


ps. i also tried to use a flag, smth like this:


PHP Code:
public void run(){

boolean flag true;

if( 
something1 && flag == true)

{

timer.scheduleAtFixedRate(TimerTasktime1time2);

}


if(
something2){

flag false;

}

if(
something3){

flag true;
}


but this also did not pause (even did not stop!) my timer...


i'll be gratefull for any suggestions..


regards
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

Vespa 12 Volt Ht Unit Coil With Lead For Lml 2T
$28.99
Vespa 12 Volt Ht Unit Coil With Lead For Lml 2T  picture165903 Old-Stock, Idec RH4B-UL-AC230 Plug In Relay 10A, 240VAC, Coil: 230VAC
$14.63
165903 Old-Stock, Idec RH4B-UL-AC230 Plug In Relay 10A, 240VAC, Coil: 230VAC picture166303 Old-Stock, Yale 524148337 Solenoid Coil, 24V
$34.92
166303 Old-Stock, Yale 524148337 Solenoid Coil, 24V pictureASCO 8551A001ms 120VAC Solenoid Valve with Coil - NEW
$44.63
ASCO 8551A001ms 120VAC Solenoid Valve with Coil - NEW pictureIDEC RH1B-U AC120 Relay, Coil: 120VAC (Lot of 3 relays)
$15.98
IDEC RH1B-U AC120 Relay,  Coil: 120VAC  (Lot of 3 relays) picture






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