Example usage for android.content ComponentCallbacks2 TRIM_MEMORY_COMPLETE

List of usage examples for android.content ComponentCallbacks2 TRIM_MEMORY_COMPLETE

Introduction

In this page you can find the example usage for android.content ComponentCallbacks2 TRIM_MEMORY_COMPLETE.

Prototype

int TRIM_MEMORY_COMPLETE

To view the source code for android.content ComponentCallbacks2 TRIM_MEMORY_COMPLETE.

Click Source Link

Document

Level for #onTrimMemory(int) : the process is nearing the end of the background LRU list, and if more memory isn't found soon it will be killed.

Usage

From source file:Main.java

public static String getTrimLevelName(int level) {
    switch (level) {
    case ComponentCallbacks2.TRIM_MEMORY_COMPLETE:
        return "COMPLETE";
    case ComponentCallbacks2.TRIM_MEMORY_MODERATE:
        return "MODERATE";
    case ComponentCallbacks2.TRIM_MEMORY_BACKGROUND:
        return "BACKGROUND";
    case ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN:
        return "UI_HIDDEN";
    case ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL:
        return "RUNNING_CRITICAL";
    case ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW:
        return "RUNNING_LOW";
    case ComponentCallbacks2.TRIM_MEMORY_RUNNING_MODERATE:
        return "RUNNING_MODERATE";
    default://from   w ww. j  ava 2s  .c  om
        return "UNKNOWN";
    }
}

From source file:org.droid2droid.ui.contacts.AbstractSMSFragment.java

public static void onTrimMemory(int level) {
    if (level == ComponentCallbacks2.TRIM_MEMORY_COMPLETE) {
        sBitmapCache.clear();/*from   ww w.  ja va  2 s  .c  o  m*/
        if (D)
            Log.d(TAG_SMS, PREFIX_LOG + "Clean contacts pictures");
    }
}

From source file:github.popeen.dsub.service.DownloadService.java

@Override
public void onTrimMemory(int level) {
    ImageLoader imageLoader = SubsonicActivity.getStaticImageLoader(this);
    if (imageLoader != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        Log.i(TAG, "Memory Trim Level: " + level);
        if (level < ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN) {
            if (level >= ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL) {
                imageLoader.onLowMemory(0.75f);
            } else if (level >= ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW) {
                imageLoader.onLowMemory(0.50f);
            } else if (level >= ComponentCallbacks2.TRIM_MEMORY_RUNNING_MODERATE) {
                imageLoader.onLowMemory(0.25f);
            }/*  w  ww. j av  a 2s  .  c o  m*/
        } else if (level >= ComponentCallbacks2.TRIM_MEMORY_MODERATE) {
            imageLoader.onLowMemory(0.25f);
        } else if (level >= ComponentCallbacks2.TRIM_MEMORY_COMPLETE) {
            imageLoader.onLowMemory(0.75f);
        }
    }
}