Is it possible to override the behaviour of the default close button on custom chrome tabs in Android? For example instead of just closing the chrome tab, can we redirect to a new Activity, or launch a dialog?
Asked
Active
Viewed 3,677 times
1 Answers
8
I'm not sure if you can do that. You can try to start the CustomTabIntent for result and wait for it finish and start it from onActivityResult()
based on the requestCode
you have started it with.
private void openUrlForResult(CustomTabsIntent customTabsIntent, String url, int requestCode){
customTabsIntent.intent.setData(Uri.parse(url));
startActivityForResult(customTabsIntent.intent, requestCode);
}

Nikola Despotoski
- 49,966
- 15
- 119
- 148
-
Thank you that helped. Although my problem turned out to be a lot more simpler. – moud Nov 20 '15 at 08:13
-
Would you be so kind to share it with us? – Vlad May 01 '16 at 04:53
-
you can also use onRestart() of parent Activity – Akash kumar Jun 30 '20 at 13:23
-
awesome solution , had been banging my head for quiet sometime for this – Ayush Bansal Jul 06 '21 at 13:13