I want to pause the "timer" thread....or i can say want to put it into "wait" mode and then notify after something gets completed.
Timer _catchTimer = new Timer();
CatchAppNameTimer _catchTimerTask = new CatchAppNameTimer(_catchTimer);
_catchTimer.schedule(_catchTimerTask, 0, 5000);
My "TimerTask ( _catchTimerTask ) " everytime shows a Popup screen ....that popup screen has two buttons - Unlock, Cancel.
basically i want that until user clicks on.... one of the Unlock / cancel btn, Time thread gets set on wait mode..... when user click one of the Unlock / Cancel button............ only after then Time thread gets notifiy.
Currently I am using a boolean variable in run method of "timertask" ..... to handle the deadlock situation...... that is TimerTask get called in every few secs......even when popup screen already shown..........
As follows :
public void run() {
GlobalSingleton obj = null;
obj = GlobalSingleton.getInstance();
if( obj.getShowDialog() )
return;
unlockField();
}
when first time "unlockFiled()" called........i set a boolean variable as true (using Runtime Store) ....... which value is retrived by getShowDialog() method. and in
fieldChanged(Field field, int context) { } method of both Unlock / Cancel button......... i set the boolean var's value as false...... by calling ...
GlobalSingleton obj = null;
obj = GlobalSingleton.getInstance();
obj.setShowDialog(false);
But the right approch is "timer-task" should not be started again....... untilll user press either Unblock / Cancel button and control gets out of the fieldChanged(Field field, int context) { } method.
shuld i use a differnet thread to handle the....wait - notify operations on the Timer object....on the basis of a boolean variable. i hv already tried this approach.......... but cant get a solution...
i'll be gratefull for any suggestions....
Regards.