Intent 标志
FLAG_ACTIVITY_REORDER_TO_FRONT
If set in an Intent passed to Context.startActivity(), this flag will cause the launched activity to be brought to the front of its task's history stack if it is already running.
Intent Intent = new Intent();
Intent.setClass(A.this, B.class);
intent.addFlag(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
A.startActivity(intent);
如果B 实例存在历史的堆栈中, 将会调用在A 之上的位置(在堆栈中).
目的: 防止重复实例的生成
Intent标志详解
本文详细介绍了Android开发中Intent的FLAG_ACTIVITY_REORDER_TO_FRONT标志的作用及使用方法。当设置此标志后,启动的活动若已在任务堆栈中运行,则会将其移至堆栈顶部,避免重复实例的创建。
469

被折叠的 条评论
为什么被折叠?



