ListenableResultFuture

  • ListenableResultFuture extends the standard Future to provide a callback mechanism for results.

  • Results are delivered to the OnResultListener provided via setOnResultListener, ensuring execution on the UI thread.

  • It inherits methods from Future for managing task cancellation and retrieving results (e.g., get(), cancel()).

  • This interface facilitates asynchronous operations with UI updates by simplifying result handling on the main thread.

public interface ListenableResultFuture implements Future<T>

A Future that accepts an onResult listener that will be called on the UI thread.

Nested Class Summary

interface ListenableResultFuture.OnResultListener<T> Interface definition for a callback to be invoked when a result is available. 

Public Method Summary

abstract void
setOnResultListener(OnResultListener<T> listener)
Sets the listener that will be called when a result is available.

Inherited Method Summary

Public Methods

public abstract void setOnResultListener (OnResultListener<T> listener)

Sets the listener that will be called when a result is available. The listener will be called on the UI thread.

Parameters
listener the callback this future will invoke when a result is available