如何重新打开一堆Activity?

发布于 2024-09-17 06:06:14 字数 365 浏览 7 评论 0原文

我的应用程序由“Main.java”(活动)启动,并打开一个通知和一个名为“Sub.java”的第二个活动,现在我按下主页按钮,应用程序消失(直到这里一切正常)。

如果我现在单击“Main.java”活动已启动的通知,则“Sub.java”似乎丢失了。 是否有可能将活动堆栈重新排序到前面?

非常感谢您的任何答复。

我的问题的示例可以在这里找到: 整个 Eclipse 项目:http://files.foxylion.de/android/problems/sample1。邮编

my App is Launched by "Main.java" (Activity) and opens a Notification and a second Activity called "Sub.java", now I press the Home-Button and the App disapears (everything okay until here).

If I'll now click on the Notification the "Main.java"-Activity is launched, the "Sub.java" seems to be lost.
Is there any posibility to reorder the Stack of Activities to the front?

Thanks a lot for any answer.

Example of my Problem is found here:
entire eclipse project: http://files.foxylion.de/android/problems/sample1.zip

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

新雨望断虹 2024-09-24 06:06:14

谷歌搜索了很长时间后解决了这个问题;)

添加

notificationIntent.setAction("android.intent.action.MAIN");
notificationIntent.addCategory("android.intent.category.LAUNCHER");

到通知意图将防止任务总是重新启动。

我在从非活动上下文调用的日志 startActivity 中找到了解决方案的提示;强制 Intent.FLAG_ACTIVITY_NEW_TASK 为:Intent ...,在谷歌搜索后解决方案位于此网站上:http://www.mail-archive.com/[电子邮件&n bsp;受保护]/msg19285.html

Solved the problem after googling for a long time ;)

Adding

notificationIntent.setAction("android.intent.action.MAIN");
notificationIntent.addCategory("android.intent.category.LAUNCHER");

to the notification-intent will prevent the task from beeing always restarted.

The hint to the solution i found in the logs startActivity called from non-Activity context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for: Intent ..., after googling the solution was on this site: http://www.mail-archive.com/[email protected]/msg19285.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文