public class EventHandlerEx extends EventHandler
InnerEvent and Runnable objects on asynchronous threads.
Each EventHandlerEx instance is bound to a thread, and the thread has an event queue.
The thread cyclically retrieves events from the event queue and dispatches the events to the EventHandlerEx
for processing. The EventHandlerEx delivers an event or a Runnable task to the thread's event queue
and executes the event or task when it comes out of the event queue.
You can use an EventHandlerEx to dispatch and process events and Runnable objects among different
threads and to schedule events or Runnable objects to be processed at a certain interval.
You can use methods provided in this class to send a synchronous or asynchronous event, delay the processing of an event, and set the event priority.
You need to override the EventHandler.processEvent(ohos.eventhandler.InnerEvent) method to process events.
EventHandler.Priority| 构造器 | 说明 |
|---|---|
EventHandlerEx(EventRunner runner) |
A constructor used to create an
EventHandlerEx instance and bind it to an EventRunner. |
current, distributeEvent, dump, getEventName, getEventRunner, hasInnerEvent, hasInnerEvent, hasInnerEvent, hasInnerEvent, hasInnerEvent, isIdle, postSyncTask, postSyncTask, postTask, postTask, postTask, postTask, postTask, postTimingTask, postTimingTask, postTimingTask, processEvent, removeAllEvent, removeEvent, removeEvent, removeEvent, removeEvent, removeTask, removeTask, sendEvent, sendEvent, sendEvent, sendEvent, sendEvent, sendEvent, sendEvent, sendEvent, sendSyncEvent, sendSyncEvent, sendSyncEvent, sendSyncEvent, sendTimingEvent, sendTimingEvent, sendTimingEvent, sendTimingEvent, toStringpublic EventHandlerEx(EventRunner runner) throws IllegalArgumentException
EventHandlerEx instance and bind it to an EventRunner.runner - Indicates the EventRunner instance running the EventHandler.IllegalArgumentException - Throws this exception if the given EventRunner is invalid.