arch-android

//Android/br.com.arch.toolkit.android.util/ContextProvider

ContextProvider

[android]
object ContextProvider

Lightweight global Context accessor backed by WeakReference.

The latest created/resumed Activity is preferred, with Application as fallback. Because references are weak, consumers should not cache current strongly for long periods.

Properties

Name Summary
current [android]
val current: ERROR CLASS: Symbol not found for Context??
Last available Context, or null if it has been garbage collected.

Functions

Name Summary
init [android]
fun init(context: ERROR CLASS: Symbol not found for Context)
Initializes the provider with any Android Context.
register [android]
fun register(application: ERROR CLASS: Symbol not found for Application)
Registers activity lifecycle callbacks in application to keep current up to date.