[Android] Clear image cache when app is in background

Geoffrey Métais git at videolan.org
Thu Jan 28 16:30:15 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jan 28 16:28:30 2016 +0100| [4e87559baef825d8280a56b93e4d1fb7ec8ac83e] | committer: Geoffrey Métais

Clear image cache when app is in background

> https://code.videolan.org/videolan/vlc-android/commit/4e87559baef825d8280a56b93e4d1fb7ec8ac83e
---

 vlc-android/src/org/videolan/vlc/VLCApplication.java | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/VLCApplication.java b/vlc-android/src/org/videolan/vlc/VLCApplication.java
index 96272d0..744be86 100644
--- a/vlc-android/src/org/videolan/vlc/VLCApplication.java
+++ b/vlc-android/src/org/videolan/vlc/VLCApplication.java
@@ -112,6 +112,14 @@ public class VLCApplication extends Application {
         BitmapCache.getInstance().clear();
     }
 
+    @Override
+    public void onTrimMemory(int level) {
+        super.onTrimMemory(level);
+        Log.w(TAG, "onTrimMemory, level: "+level);
+
+        BitmapCache.getInstance().clear();
+    }
+
     /**
      * @return the main context of the Application
      */



More information about the Android mailing list