我要开始从状态栏通知,一个活动A当的活动时,已经在前面的话,我要完成这一点,重新开始活动答:我怎样才能做到这一点?
I want to start a Activity A from status bar notification, When the activity A is already in front then i want to finish that and fresh start activity A. How can i do this?
推荐答案
查看关于创建状态栏通知的文件。这无疑涉及使用意图和PendingIntent从通知开始和活动。
Review the documentation on creating Status Bar Notifications. This definitely covers starting and Activity from a Notification using an Intent and PendingIntent.
http://developer.android.com/guide/topics/ UI /通知者/ notifications.html
至于如果该活动已经在运行,完成它和新鲜的开始吧...我不知道,可以很容易地完成,这取决于你真正想要的。您可以做一些与清单中的发射方式活动参数:
As for if the Activity is already running, finish it and start it freshly... I'm not sure that can be done easily, depending on what you really want. You may be able to do something with the launch mode activity parameter in the manifest:
的http://developer.android.com/guide/topics/manifest/activity-element.html#lmode
再有你的活动响应(与onNewIntent()最有可能的)和复位本身编程。有可能是这样的:
And then have your activity respond (with onNewIntent() most likely) and "reset" itself programmatically. Possibly with something like this:
Android的重新启动我的活动
相关推荐
最新文章