It is best to create a class that extends the application. This application class will give you an onlowmemory () callback whenever the application goes into low memory. there you can write
public void onLowmemory() { Runtime.getRuntime().gc(); }
which will invoke the GC system method. When you start the garbage collector, android will garbage all unused objects.
There is another way to solve this problem. In animation, you can call Runtime.getRuntime (). Gc (); to call the garbage collector. also in the onDestroy () action, the u method can call Runtime.getRuntime (). gc ();
so your problem will be solved.
user1087919
source share