I have one Activity MainActivity
. It contains a ViewPager
hosting a fragment FragmentPlaceHolder
. This fragment has a RecyclerView
.
Now, on a click of a particular view, say button, inside a RecyclerView
item, I want to open a chrome custom tab in new Activity
. Can anyone help me with this one ? I am expecting a step wise implemention of Chrome Custom tabs
.
Thanks.
So, I did it this way:
First of all, add this following dependency in
build.gradle(app)
:First create an activity
WebviewActivity
:WebViewActivity.java
Now, say on button click you want to open chrome custom tab and load
www.google.com
, so, do it as below:activity_webview.xml
Then, simply craete the classes as below:
CustomTabActivityHelper.java
CustomTabsHelper.java
ServiceConnection.java
ServiceConnectionCallback.java
WebviewFallback.java
By now, you should be able to open Chrome custom tab.
If found any issue with this, just let me know.
add next string to tour code before WebSettings webSettings