首页设备列表,添加设备
This commit is contained in:
@@ -82,4 +82,39 @@ public class ActivityManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 关闭指定tag的所有Activity
|
||||
*
|
||||
* @param tag 比如 add_device_flag
|
||||
*/
|
||||
public static void removeActivityByTag(String tag)
|
||||
{
|
||||
if(activitys == null || activitys.isEmpty()){
|
||||
return;
|
||||
}
|
||||
|
||||
//避免遍历时ConcurrentModificationException
|
||||
Map<String, Activity> tempMap =
|
||||
new HashMap<>(activitys);
|
||||
|
||||
for (Map.Entry<String, Activity> entry : tempMap.entrySet()) {
|
||||
|
||||
String key = entry.getKey();
|
||||
Activity activity = entry.getValue();
|
||||
|
||||
if (key != null && key.contains(tag)) {
|
||||
|
||||
if (activity != null &&
|
||||
!activity.isFinishing() &&
|
||||
!activity.isDestroyed()) {
|
||||
|
||||
activity.finish();
|
||||
}
|
||||
|
||||
activitys.remove(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user