I have a chrome custom tab, but I want to add a listener to the close (X) button on the upper left corner of the title bar.
I want to trigger a callback every time the user clicks on the close button.
I was able to do that in a web view, but unable to figure out if that is possible for a chrome custom tab.
Here is the code snippet i use to call a custom tab:
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
builder.enableUrlBarHiding();
builder.setToolbarColor(getTitleBarBackgroundColor());
builder.setStartAnimations(this, android.R.anim.slide_in_left, android.R.anim.slide_out_right);
builder.setExitAnimations(this, android.R.anim.slide_in_left, android.R.anim.slide_out_right);
customTabsIntent = builder.build();
customTabsIntent.intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
customTabsIntent.launchUrl(this, Uri.parse(url));