Language

Fragment.OnTrimMemory(TrimMemory) Method

Definition

Called when the operating system has determined that it is a good time for a process to trim unneeded memory from its process.

[Android.Runtime.Register("onTrimMemory", "(I)V", "GetOnTrimMemory_IHandler")]
public virtual void OnTrimMemory(Android.Content.TrimMemory level);
[<Android.Runtime.Register("onTrimMemory", "(I)V", "GetOnTrimMemory_IHandler")>]
abstract member OnTrimMemory : Android.Content.TrimMemory -> unit
override this.OnTrimMemory : Android.Content.TrimMemory -> unit

Parameters

level
TrimMemory

The trim level, which indicates how much memory the application may need to release. Named levels include Complete, Moderate, Background, UiHidden, RunningCritical, RunningLow, and RunningModerate.

Implements

Attributes

Remarks

Called when the operating system has determined that it is a good time for a process to trim unneeded memory from its process. You should never compare to exact values of the level, since new intermediate values may be added -- you will typically want to compare if the value is greater or equal to a level you are interested in. To retrieve the processes current trim level at any point, you can use ActivityManager.getMyMemoryState(RunningAppProcessInfo). If you override this method you must call through to the superclass implementation.

Android reference for android.app.Fragment.onTrimMemory.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to