Search code examples
androidandroid-fragmentsnotificationsstatusbarandroid-notifications

notification on lock/home button press, on click back to tab fragment


once again.... I'm following this tutorial androidhive tab layout with swipe able views... I have the tab layout in one of the sub activities. The MainActivity is a list view where clicking on one of the items in the list view, it opens up the tab layout/activity. In the last tab, i have a count down timer of 20 seconds, users have to lock their phone or press the home button to do a notification (at the status bar) demo. As the tab is a fragment, how do I reopen the app by tapping on the notification at the status bar to bring them back to the third tab/fragment?

I have been searching but none of the answer seems to be what i am looking for. I hope someone out there do guide me along as I want to learn more. Thank you!


Solution

  • Thanks to this answer and this sample notification tutorial, I was able to get what I want. All it needed was to set singleTop to the activity in manifest if you don't want the activity to be called twice.