isTaskRoot() 方法
Return whether this activity is the root of a task. The root is the first activity in a task.
Returns:
True if this is the root activity, else false.
返回此活动是否是任务的根。 根是任务中的第一个活动。
回报:
如果这是根活动,则为真,否则为假。
解决方案
public class SplashActivity extends BaseActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 判断activity 是否为根结点
if (!isTaskRoot()) {
finish();
return;
}
}
}