Back to project page Common-Library.
The source code is released under:
Apache License
If you think the Android project Common-Library listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.morgan.library.async; /*from ww w. j ava2 s .c om*/ import java.util.HashMap; import java.util.Map; /** * ??????????Activity?Fragment?????????????????????????????????????????????????????????? * ???????????????? ???????????????????????????????widget??{@link Destroyable} * ????,??????????? {@link #addItem(String, DestroyAble)} * ????????????????Activity?Fragment????????{@link #onDestory()}??? * * @author Morgan.Ji * */ public class TaskManager { private Map<String, Destroyable> mItems = new HashMap<String, Destroyable>(); /** * @param key * ???????????????? ?????key??????????????????? * @param item * ????????? */ public void addItem(String key, Destroyable item) { Destroyable old = mItems.get(key); if (null != old) { old.onDestory(); } mItems.put(key, item); } /** * ?????????????????? */ public void onDestory() { for (String key : mItems.keySet()) { mItems.get(key).onDestory(); } } }