diff --git a/doric-android/doric/src/main/java/pub/doric/DoricContext.java b/doric-android/doric/src/main/java/pub/doric/DoricContext.java index 6e548fac..82252cd0 100644 --- a/doric-android/doric/src/main/java/pub/doric/DoricContext.java +++ b/doric-android/doric/src/main/java/pub/doric/DoricContext.java @@ -33,6 +33,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Map; +import java.util.Set; import java.util.WeakHashMap; import java.util.concurrent.Callable; @@ -190,10 +191,13 @@ public class DoricContext { } public void teardown() { - for (Animator animator : animators.values()) { - animator.cancel(); + Set animatorIds = animators.keySet(); + for (String animatorId : animatorIds) { + Animator animator = animators.remove(animatorId); + if (animator != null) { + animator.cancel(); + } } - animators.clear(); callEntity(DoricConstant.DORIC_ENTITY_DESTROY).setCallback(new AsyncResult.Callback() { @Override public void onResult(JSDecoder result) {