public static void openCustomTab(Activity activity,
                                     CustomTabsIntent customTabsIntent,
                                     Uri uri,
                                     CustomTabFallback fallback) {
        String packageName = CustomTabsHelper.getPackageNameToUse(activity);

        //If we cant find a package name, it means theres no browser that supports
        //Chrome Custom Tabs installed. So, we fallback to the webview
        if (packageName == null) {
            if (fallback != null) {
                fallback.openUri(activity, uri);
            }
        } else {
            customTabsIntent.intent.setPackage(packageName);
            customTabsIntent.launchUrl(activity, uri);
        }
    }
Opens the URL on a Custom Tab if possible. Otherwise fallsback to opening it on a WebView.

@param activity The host activity.
@param customTabsIntent a CustomTabsIntent to be used if Custom Tabs is available.
@param uri the Uri to be opened.
@param fallback a CustomTabFallback to be used if Custom Tabs is not available.
demos/src/main/java/org/chromium/customtabsdemos/CustomTabActivityHelper.java