How can I navigate from an activity to another usi

2019-08-02 21:30发布

In my app I have two activities (AuthenticationActivity and MainActivity), each one with a nav graph and a big flow of fragments. I've created an action to navigate from a fragment of the AuthenticationActivity's graph to the MainActivity but it does not remove the AuthenticationActivity from the stack even if I set 'popTo' to the Authentication graph id.

1条回答
来,给爷笑一个
2楼-- · 2019-08-02 21:45

finish authentication activity after navigate method:

button2.setOnClickListener {
        view.findNavController().navigate(R.id.action_addItemFragment_to_mainActivity)
        (activity as AuthenticationActivity).finish()
    }
查看更多
登录 后发表回答