我想从状态栏通知启动 Activity A,当 Activity A 已经在前面时,我想完成它并重新启动 Activity A。我该怎么做?
最佳答案
查看有关创建状态栏通知的文档。这肯定涵盖了使用 Intent 和 PendingIntent 的 Notification 的启动和 Activity。
http://developer.android.com/guide/topics/ui/notifiers/notifications.html
至于 Activity 是否已经在运行,完成它并重新启动它...我不确定是否可以轻松完成,具体取决于您真正想要什么。您可以使用 list 中的启动模式 Activity 参数执行某些操作:
http://developer.android.com/guide/topics/manifest/activity-element.html#lmode
然后让您的 Activity 响应(最有可能使用 onNewIntent())并以编程方式“重置”自身。可能是这样的:
关于android - 从 android 中的通知开始新 Activity ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5769192/