Android service puts multiple instances of an activity in the history

Posted by HenryAdamsJr on Stack Overflow See other posts from Stack Overflow or by HenryAdamsJr
Published on 2010-12-26T23:50:44Z Indexed on 2010/12/26 23:53 UTC
Read the original article Hit count: 190

Filed under:
|
|
|

I'm making a music player. When you press play, it loads a notification into the OnGoing section. When you go anywhere else in the system, I want the music to keep playing. All of this is fine.

The problem is that when I relaunch my activity from the Notification, it adds a task to the history stack each time, so if I hit back, I have to see the instance of Activity B from where I pressed play, and from every time I clicked on the notification to go back to Activity B.

I want the instance of Activity B that I launch from the notification (via the service) to be the only copy of that Activity in the history. I've been playing around with various Intent flags and Activity attributes in the manifest, but I haven't found the proper combination.

© Stack Overflow or respective owner

Related posts about android

Related posts about service