0

I am trying to dynamically update the title from a fragment. As the number of items in a list changes, the title would change accordingly.

I tried this

<fragment
    android:id="@+id/myFragment"
    android:name=".MyFragment"
    android:label="{dynamicTitle}">
  <argument
      android:name="dynamicTitle"
      app:argType="string"/>
</fragment>

from https://stackoverflow.com/a/55701078/1067596 and by changing the arguments at runtime.

This updates the title only on a navigation change or a configuration change.

Is there a way to force the navigation controller to refresh the title of the current fragment, from the argument without navigating away, or does it make more sense to access the toolbar and update its title manually?

hoshiKuzu
  • 866
  • 1
  • 12
  • 30

0 Answers0