我有3个片段,我正在用nav_graph控制它们。第一个是ListingEvents,第二个是ListingItemsofevents,最后一个是更新的项目。
当我更新项目并单击“ Update”按钮时,它会输入VolistingItemsofevents片段,这很好。但是,在ListInListingItemsofevents上,当我单击“返回”按钮时(我在第二张图片上绘制蓝色),我想打开Listingingevents Fragment。使用我的代码,它返回更新片段。当我单击“后面”按钮时,如何打开ListingEvents片段(我在第二张图片上画了蓝色)?
I have 3 fragments and I am controlling them with a nav_graph. The first one is listingEvents, the second one is listingItemsOfEvents and the last one is updateListing items.
When I update items and click "Update" button, It goes tolistingItemsOfEvents fragment, it is nice. However on listinlistingItemsOfEvents when I click the back button(I drew blue color on second picture) I want to open listingEvents fragment. With my codes it returns update fragments. How I can open listingEvents fragment when I click the back button(I drew blue color on second picture)?
发布评论
评论(1)
要在用户从操作栏中选择时处理导航,请在您的主机活动中使用return navcontroller.navigateup()覆盖onsupportNavigateUp,
To handle navigation when the user chooses Up from the action bar, override onSupportNavigateUp with returning navController.navigateUp() in your host activity like this,