Class POBTimeoutHandler
-
- All Implemented Interfaces:
@MainThread() public class POBTimeoutHandler
Class to handle custom implementation Timeout. To start the delay you can use start to cancel existing delay you can use cancel
Note: All the methods of this class should be called from MainThread only.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfacePOBTimeoutHandler.POBTimeoutHandlerListenerInterface definition to notify the time interval completes the delay and timeout is about to happen. Notification will always happens on MainThread
-
Constructor Summary
Constructors Constructor Description POBTimeoutHandler(POBTimeoutHandler.POBTimeoutHandlerListener listener)Initialises Timer Handler with listener reference
-
Method Summary
Modifier and Type Method Description booleanstart(long delayInMs)Schedules the specified task for execution after the specified delay. booleanstartAtFixedRate(long delayInMS, long period)Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay. voidcancel()Reset already running timer. -
-
Constructor Detail
-
POBTimeoutHandler
POBTimeoutHandler(POBTimeoutHandler.POBTimeoutHandlerListener listener)
Initialises Timer Handler with listener reference- Parameters:
listener- valid reference of listener
-
-
Method Detail
-
start
@MainThread() boolean start(long delayInMs)
Schedules the specified task for execution after the specified delay. Note: If the task is already running, calling this method will cancels the existing task and schedules new task If delay is negative, timer won't start.
- Parameters:
delayInMs- the delay time in millisecond.- Returns:
true if timeout starts successfully, else returns false
-
startAtFixedRate
@MainThread() boolean startAtFixedRate(long delayInMS, long period)
Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay. Subsequent executions take place at approximately regular intervals, separated by the specified period. Note: If the task is already running, calling this method will cancels the existing task and schedules new task If delay is negative, timer won't start.
- Parameters:
delayInMS- the delay time in millisecond.period- regular interval time in millisecond- Returns:
true if timeout starts successfully, else returns false
-
cancel
@MainThread() void cancel()
Reset already running timer. This will be the last state of the timer. You should create new object for further usage.
-
-
-
-