Release Memory of Particular Activity when it is Destroyed

前端 未结 7 1546
说谎
说谎 2020-12-15 05:38

I have a launcher Activity that load and resize big bitmap as it\'s background when it opens.

Whenever hit the back button, the Activity is

相关标签:
7条回答
  • 2020-12-15 06:19

    In activity if you're calling the finish() method from is destroyed and all its resources are queued for garbage collection.

    So, all memory that was used by this activity will be freed during next GC cycle.

    OR

    you can try this to clean memory,

    @Override
    public void onDestroy() {
        super.onDestroy();
        Runtime.getRuntime().gc();      
    }
    

    check this details. hope that helps.

    0 讨论(0)
提交回复
热议问题