ControllableTask

public abstract class ControllableTask extends CancellableTask<TState>
Known Direct Subclasses
Known Indirect Subclasses

Represents an asynchronous operation that can be paused, resumed and canceled. This task also receives progress and other state change notifications.

Public Constructor Summary

Public Method Summary

abstract ControllableTask<TState>
addOnPausedListener(Activity activity, OnPausedListener<? super TState> listener)
Adds a listener that is called when the Task becomes paused.
abstract ControllableTask<TState>
addOnPausedListener(OnPausedListener<? super TState> listener)
Adds a listener that is called when the Task becomes paused.
abstract ControllableTask<TState>
addOnPausedListener(Executor executor, OnPausedListener<? super TState> listener)
Adds a listener that is called when the Task becomes paused.
abstract boolean
abstract boolean
pause()
Attempts to pause the task.
abstract boolean
resume()
Attempts to resume this task.

Inherited Method Summary

Public Constructors

public ControllableTask ()

Public Methods

public abstract ControllableTask<TState> addOnPausedListener (Activity activity, OnPausedListener<? super TState> listener)

Adds a listener that is called when the Task becomes paused.

Parameters
activity When the supplied Activity stops, this listener will automatically be removed.
Returns
  • this Task

public abstract ControllableTask<TState> addOnPausedListener (OnPausedListener<? super TState> listener)

Adds a listener that is called when the Task becomes paused.

Returns
  • this Task

public abstract ControllableTask<TState> addOnPausedListener (Executor executor, OnPausedListener<? super TState> listener)

Adds a listener that is called when the Task becomes paused.

Parameters
executor the executor to use to call the listener
Returns
  • this Task

public abstract boolean isPaused ()

Returns
  • true if the task has been paused.

public abstract boolean pause ()

Attempts to pause the task. A paused task can later be resumed.

Returns
  • true if this task was successfully paused or is in the process of being paused. Returns false if the task is already completed or in a state that cannot be paused.

public abstract boolean resume ()

Attempts to resume this task.

Returns
  • true if the task is successfully resumed or is in the process of being resumed. Returns false if the task is already completed or in a state that cannot be resumed.