Change title of the view at runtime

How can I change the title of a list or detail view from the controller?

Hi Mortoza!

You should override the getPageTitle() method in your controller to provide a new title.
Please note that the title will only be applied only once during navigation.

Regards,
Dmitriy

Hi Dmitriy
Is it using viewControllerUtils.getPageTitle(this)? but I can see only get not set!

can you share code snippets?

As I wrote above, you should OVERRIDE the method.

Code snippet provided:

    @Override
    public String getPageTitle() {
        String yourPageTitle = "Put your page title here"
        return Strings.isNullOrEmpty(yourPageTitle)
                ? super.getPageTitle()
                : yourPageTitle;
    }
1 Like

Thank you.

Hi,

Thanks, It works in StandardDetailView & StandardListView. But it doesnt work in Fragment.

Thank you for ur reply.

Regards,
Chee Hao

Hi!

Fragments don’t have their own title because they are embedded layouts.

Best regards,
Dmitriy