Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@Override
protected void onDestroy() {
super.onDestroy();
customTabActivityHelper.setConnectionCallback(null);
}
@Override
protected void onStart() {
super.onStart();
customTabActivityHelper.bindCustomTabsService(this);
}
@Override
protected void onStop() {
super.onStop();
customTabActivityHelper.unbindCustomTabsService(this);
}
@Override
public void onClick(View view) {
int viewId = view.getId();
Uri uri = Uri.parse(mUrlEditText.getText().toString());
switch (viewId) {
case R.id.button_may_launch_url:
customTabActivityHelper.mayLaunchUrl(uri, null, null);
break;
case R.id.start_custom_tab:
CustomTabsIntent customTabsIntent =
new CustomTabsIntent.Builder(customTabActivityHelper.getSession())
.build();
CustomTabActivityHelper.openCustomTab(
this, customTabsIntent, uri, new WebviewFallback());
break;
default:
//Unkown View Clicked
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment