简体   繁体   English

如果我在 android 中不使用 launchMode “singleTask” 会怎样?

[英]What happens if I don't use launchMode “singleTask” in android?

I am implementing picture in picture mode.我正在以图片模式实现图片。 Documentation says you can use android:launchMode="singleTask" and override onNewIntent().文档说您可以使用android:launchMode="singleTask"并覆盖 onNewIntent()。 If I does so, it calls onConfigurationChanged() (if activity is in picture in picture mode).如果我这样做,它会调用 onConfigurationChanged() (如果活动处于画中画模式)。 So, I don't want this.所以,我不想要这个。

What happens if I don't use singleTask launchMode?如果我不使用 singleTask 启动模式会怎样? Does it will cause some problems or bugs when that particular activity is launched for the second time?第二次启动该特定活动时是否会导致一些问题或错误?

For PIP, using singleTask is ideal as it will create a whole different stack for handling PIP features.对于 PIP,使用singleTask是理想的,因为它将创建一个完全不同的堆栈来处理 PIP 功能。 If the user is in pip mode and if the user clicks on the app icon, no new task will be created, the same task will be reused and intent will be passed to onNewIntent(Intent intent) method.如果用户处于 pip 模式,并且如果用户点击应用程序图标,则不会创建新任务,将重复使用相同的任务并将意图传递给onNewIntent(Intent intent)方法。 By this way, we can implement pip in single activity app as we don't have to maintain backstack in a single activity.通过这种方式,我们可以在单个 Activity 应用程序中实现 pip,因为我们不必在单个 Activity 中维护 backstack。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM