public final class AsyncCommonEventResult extends Object
An AsyncCommonEventResult object is returned by CommonEventSubscriber#goAsyncCommonEvent()
in the CommonEventSubscriber#onReceiveEvent(CommonEventData) callback method. This allows your application
to process the current common event on another thread instead of the main thread. However, this requires that
your application call the finishCommonEvent() method when processing of the common event is complete.
SystemCapability.Notification#CES| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
abortCommonEvent() |
Cancels the current ordered common event.
|
void |
clearAbortCommonEvent() |
Clears the abort state of the current ordered common event.
|
void |
finishCommonEvent() |
Finishes processing the current ordered common event.
|
boolean |
getAbortCommonEvent() |
Checks whether the current ordered common event should be aborted.
|
int |
getCode() |
Obtains the result code of the current ordered common event.
|
String |
getData() |
Obtains the result data of the current ordered common event.
|
void |
setCode(int code) |
Sets the result code of the current ordered common event.
|
void |
setCodeAndData(int code,
String data) |
Sets the result of the current ordered common event.
|
void |
setData(String data) |
Sets the result data of the current ordered common event.
|
public void setCode(int code)
CommonEventSubscriber#setCode(int) for asynchronous common event processing.code - Indicates the custom result code to set. You can set it to any int value.IllegalArgumentException - Throws this exception if the current common event is not an ordered
common event.public int getCode()
CommonEventSubscriber#getCode() for asynchronous common event processing.public void setData(String data)
CommonEventSubscriber#setData(String) for asynchronous common event processing.data - Indicates the custom result data to set. You can set it to any character string.IllegalArgumentException - Throws this exception if the current common event is not an ordered
common event.public String getData()
CommonEventSubscriber#getData() for asynchronous common event processing.public void setCodeAndData(int code,
String data)
CommonEventSubscriber#setCodeAndData(int, String) for asynchronous common event processing.code - Indicates the custom result code to set. You can set it to any int value.data - Indicates the custom result data to set. You can set it to any character string.IllegalArgumentException - Throws this exception if the current common event is not an ordered
common event.public void abortCommonEvent()
CommonEventSubscriber#abortCommonEvent() for asynchronous common event processing.IllegalArgumentException - Throws this exception if the current common event is not
an ordered common event.public boolean getAbortCommonEvent()
CommonEventSubscriber#getAbortCommonEvent() for asynchronous common event processing.true if the common event should be aborted; returns false otherwise.public void clearAbortCommonEvent()
CommonEventSubscriber#clearAbortCommonEvent() for asynchronous common event processing.public void finishCommonEvent()
IllegalArgumentException - Throws this exception if the current common event is not an ordered
common event.