我在这里创建了一个示例项目:
https://github.com/amitishai/Android-notifications
场景如下:
- 打开应用
- 按下按钮
- 退出应用
- 点击创建的通知。当应用程序打开时,您将处于 Activity “Bla”中。
- 按操作系统返回按钮。
- 长按操作系统主页按钮以查看打开的应用。
- 点击该应用。
你会看到你又进入了Activity“Bla”,文字是一样的。
如果 Activity 最初是用 Intent 创建的,然后销毁了,重新启动 Activity 时 Intent 如何不为空?
最佳答案
解决方案是使用 Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY 示例在这里: Android: Starting app from 'recent applications' starts it with the last set of extras used in an intent
关于android - 使用后删除 Intent ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17322086/