开发者

Close activity via click on Android notification list

I'm looking to find out how to stop an activity inste开发者_运维知识库ad of resuming upon the click of the item on the notification list. Any ideas?


Overload onNewIntent in your activity and when you get the intent from the pending intent just call finish()

Your activiy will need to be a singleInstance activity though. Otherwise, a new activity will get created on the task stack when the notification item is clicked.


Can you be more specific about what you're doing. Are you trying to write another Task-Killer-like application? or perhaps some kind of music player application? Telling us about the kind of application you're writing can help us help you.

By the way, using the term "resuming" shows that you haven't fully understood the Activity lifecycle yet. onResume is for resuming the UI thread. onRestart is the one that's used for restarting the Activity.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜