public abstract class Task extends Object
| 限定符和类型 | 类 | 说明 |
|---|---|---|
static class |
Task.State |
Indicates the running state of a task.
|
| 构造器 | 说明 |
|---|---|
Task() |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
Task.State |
getState() |
Obtains the task state.
|
void |
initialize() |
Initializes a task.
|
abstract void |
onCancel() |
Called back when a task is cancelled.
|
abstract boolean |
onExecute() |
Called back when executing a task.
|
abstract void |
onFinish() |
Called back when a task is finished.
|
abstract void |
onInitialize() |
Called back when initializing a task.
|
public final Task.State getState()
public final void initialize()
This method calls onInitialize() to initialize a task and set the
task state to State#RUNNING.
public abstract void onInitialize()
public abstract boolean onExecute()
This method will not be called again if the task is already executed.
true if the task is executed; returns false otherwise.public abstract void onFinish()
public abstract void onCancel()