Issue
I have an activity with a toolbar from a default layout in Android Studio and I can easily change the title in the toolbar through the following method:
Bundle bundle = new Bundle();
bundle.putString("toolbarTitle", "A new title");
NavHostFragment
.findNavController(this)
.navigate(R.id.action_navigation_conversation_to_placeholder, bundle);
Where safe args is already implemented for toolbarTitle
in the navigation menu layout.
However now I am trying to change the title from the fragment that is opened via the method above, for example;
MyActivity ->opens-> MyFragment
MyFragment changes title
I do know how to update it without using Navigation UI Components, but I want to use them if it is possible.
Other similar questions are only related to the example I already provided above for when a new fragment is being opened or by suggesting the use of the typical method that does not make use of the Navigation UI Components, none cover this specific scenario.
Solution
It seems like this is not possible with the only way to achieve this by doing it directly without using the Navigation Architecture Components.
Answered By - Shadow
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.