@Beta @Documented @Target(value=ANNOTATION_TYPE) @CanReleaseReferences @Deprecated public @interface ReleaseReferencesAt
Application.onTrimMemory(int)
.
For example:
@Documented @Retention(RUNTIME) @Target({TYPE, METHOD}) @ReleaseReferencesAt(TRIM_MEMORY_BACKGROUND) @Scope public @interface MyScope {}
Any scope annotated with @ReleaseReferencesAt
can release its references.
In order to release references in low-memory conditions, inject an AndroidMemorySensitiveReferenceManager
into your Application
and delegate
Application.onTrimMemory(int)
to it.
Modifier and Type | Required Element and Description |
---|---|
int |
value
Deprecated.
If
AndroidMemorySensitiveReferenceManager.onTrimMemory(int) is called with a value
greater than or equal to this, the scope's references will be released. |
@OnTrimMemoryValue public abstract int value
AndroidMemorySensitiveReferenceManager.onTrimMemory(int)
is called with a value
greater than or equal to this, the scope's references will be released. If it is called with a
value less than this, the scope's references will be restored.
Use one of the constants defined in ComponentCallbacks2
.