Skip to content

Instantly share code, notes, and snippets.

@saurabharora90
Last active August 18, 2018 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saurabharora90/b69cae2b9dfd56784a77241cc97a9649 to your computer and use it in GitHub Desktop.
Save saurabharora90/b69cae2b9dfd56784a77241cc97a9649 to your computer and use it in GitHub Desktop.
@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