androidx.activity.contextaware


Interfaces

ContextAware

A ContextAware class is associated with a Context sometime after the class is instantiated.

OnContextAvailableListener

Listener for receiving a callback at the first moment a Context is made available to the ContextAware class.

Classes

ContextAwareHelper

Helper class for implementing ContextAware.

Extension functions summary

suspend inline R
<R : Any?> ContextAware.withContextAvailable(
    crossinline onContextAvailable: (Context) -> R
)

Run onContextAvailable when the Context becomes available and resume with the result.

Extension functions

withContextAvailable

suspend inline fun <R : Any?> ContextAware.withContextAvailable(
    crossinline onContextAvailable: (Context) -> R
): R

Run onContextAvailable when the Context becomes available and resume with the result.

If the Context is already available, onContextAvailable will be synchronously called on the current coroutine context. Otherwise, onContextAvailable will be called on the UI thread immediately when the Context becomes available.