private void openCustomTab() {
        String url = mUrlEditText.getText().toString();

        int color = getColor(mCustomTabColorEditText);
        int secondaryColor = getColor(mCustomTabSecondaryColorEditText);

        CustomTabsIntent.Builder intentBuilder = new CustomTabsIntent.Builder();
        intentBuilder.setToolbarColor(color);
        intentBuilder.setSecondaryToolbarColor(secondaryColor);

        if (mShowActionButtonCheckbox.isChecked()) {
            //Generally you do not want to decode bitmaps in the UI thread. Decoding it in the
            //UI thread to keep the example short.
            String actionLabel = getString(R.string.label_action);
            Bitmap icon = BitmapFactory.decodeResource(getResources(),
                    android.R.drawable.ic_menu_share);
            PendingIntent pendingIntent =
                    createPendingIntent(ActionBroadcastReceiver.ACTION_ACTION_BUTTON);
            intentBuilder.setActionButton(icon, actionLabel, pendingIntent);
        }

        if (mAddMenusCheckbox.isChecked()) {
            String menuItemTitle = getString(R.string.menu_item_title);
            PendingIntent menuItemPendingIntent =
                    createPendingIntent(ActionBroadcastReceiver.ACTION_MENU_ITEM);
            intentBuilder.addMenuItem(menuItemTitle, menuItemPendingIntent);
        }

        if (mAddDefaultShareCheckbox.isChecked()) {
            intentBuilder.addDefaultShareMenuItem();
        }

        if (mToolbarItemCheckbox.isChecked()) {
            //Generally you do not want to decode bitmaps in the UI thread. Decoding it in the
            //UI thread to keep the example short.
            String actionLabel = getString(R.string.label_action);
            Bitmap icon = BitmapFactory.decodeResource(getResources(),
                    android.R.drawable.ic_menu_share);
            PendingIntent pendingIntent =
                    createPendingIntent(ActionBroadcastReceiver.ACTION_TOOLBAR);
            intentBuilder.addToolbarItem(TOOLBAR_ITEM_ID, icon, actionLabel, pendingIntent);
        }

        intentBuilder.setShowTitle(mShowTitleCheckBox.isChecked());

        if (mAutoHideAppBarCheckbox.isChecked()) {
            intentBuilder.enableUrlBarHiding();
        }

        if (mCustomBackButtonCheckBox.isChecked()) {
            intentBuilder.setCloseButtonIcon(
                    BitmapFactory.decodeResource(getResources(), R.drawable.ic_arrow_back));
        }

        intentBuilder.setStartAnimations(this, R.anim.slide_in_right, R.anim.slide_out_left);
        intentBuilder.setExitAnimations(this, android.R.anim.slide_in_left,
                android.R.anim.slide_out_right);

        CustomTabActivityHelper.openCustomTab(
                this, intentBuilder.build(), Uri.parse(url), new WebviewFallback());
    }
Opens Chrome Custom Tabs with a customized UI.
demos/src/main/java/org/chromium/customtabsdemos/CustomUIActivity.java