Chrome Custom Tabs: Icon state and responding to user actions

495 views Asked by At

It looks like the custom tab icon is static, so it couldn't respond to user changes or external changes?

To take the Pinterest example, if Pinterest has a custom tab icon like "Pin It" and user clicks on it, can it be changed to "Pinned". If not, how should the app/tab provide user feedback after such an action?

2

There are 2 answers

1
François Beaufort On BEST ANSWER

Icon can not be changed at the moment. Not sure how to handle that though.

1
Ian Wong On

This feature is now [implemented in Chrome 46] (https://codereview.chromium.org/1291083004/) together with the next version of android support library that will be released soon.

There are two ways to update the icon of action button:

  1. Using support library, you could call CustomTabSession#setActionButton(), once you have got an CustomTabSession object after creating a custom tab.
  2. If you prefer not to use the easy and beautiful support library, you could also achieve the same goal by binding to the CustomTabsService, call updateVisuals() and pass the IBinder object you got previously when binding.