Reputation: 231
first sorry for my rusty English !
This is a doubt I have had for some time now and although my skills on Android have been getting better I haven't found an elegant solution for this issue:
Lets say an application uses the Navigation Drawer pattern and has three levels of navigation: Home -> Posts -> Post details
When I open the App from the launcher I add the Home Fragment. From here the user can navigate all the way down to a given "post" using fragment transactions.
Now imagine there is some kind of notification that is letting me know something happened on a specific post: How would you create a "synthetic" back-stack when opening the app from the notification ? What I mean is:
1- Open the app from the notification
2- The app opens on Post Details
3- Back navigation has to be > Posts > Home
Thanks a lot in advance !
Upvotes: 0
Views: 148
Reputation: 19243
without any line of code its hard to say how you are setting these Fragment
s , but you may need addToBackStack method or consider @Override
onBackPressed properly. assuming notification is yours you can set id or whatever you need inside PendingIntent
extras Bundle
, obtain inside OnCreate
method and then create a stack
Upvotes: 1