Created
June 4, 2020 21:06
-
-
Save jtmuller5/09fcdf86b413c9a3a2304a120c148022 to your computer and use it in GitHub Desktop.
StartActivity Intent for Custom Tabs URL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val sendLinkIntent = Intent(main,MainActivity::class.java) | |
sendLinkIntent.putExtra(Intent.EXTRA_SUBJECT,"This is the link you were exploring") | |
val pendingIntent = PendingIntent.getActivity(main,0,sendLinkIntent,PendingIntent.FLAG_UPDATE_CURRENT) | |
// Set the action button | |
AppCompatResources.getDrawable(main, R.drawable.close_icon)?.let { | |
DrawableCompat.setTint(it, Color.WHITE) | |
builder.setActionButton(it.toBitmap(),"This is your link",pendingIntent,false) | |
} | |
// Create the Custom Tabs Intent and launch the URL | |
val customTabsIntent: CustomTabsIntent = builder.build() | |
customTabsIntent.launchUrl(main, Uri.parse(url)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With out an icon click or action can we get the url?
Lets assume that I have a url, which internally redirects I have to capture or intercept one url and then post data to another url. I have done the same in webview. I could not find the same to do in custom tab.