Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android animations memory leak

If I have infinite animation in activity and navigate away from activity, does it causes memory leak? Do I have to stop animation explicitly or is it somehow managed on framework level? What I mean by infinite animation:

<?xml version="1.0" encoding="utf-8"?>

<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:shareInterpolator="false"
    android:repeatCount="infinite">

<rotate
    android:duration="1000"
    android:interpolator="@android:anim/linear_interpolator"
    android:pivotX="50%"
    android:pivotY="50%"
    android:repeatCount="infinite"
    android:repeatMode="restart"
    android:toDegrees="360" />

like image 478
Heisenberg Avatar asked Feb 26 '26 03:02

Heisenberg


1 Answers

From developers webpage :

You should usually use the onPause() callback to: Stop animations or other ongoing actions that could consume CPU.

Source : http://developer.android.com/training/basics/activity-lifecycle/pausing.html#Pause

like image 170
Shivam Verma Avatar answered Feb 28 '26 21:02

Shivam Verma



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!