1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| /** * 清除GPU绘图缓存 */ private void cleanGraphicsCache() { Object instance = ReflectUtils.getStaticMethod("android.view.WindowManagerGlobal", "getInstance", null, null);
try { Class threadClazz = Class.forName("android.view.WindowManagerGlobal"); Method m1 = threadClazz.getDeclaredMethod("trimMemory", int.class); m1.invoke(instance, TRIM_MEMORY_COMPLETE); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } }
|