Share Links with Android Sharesheet

You’ve probably seen this before: an app has the two-line, three-dot Share icon and clicking it gives you something like the image shown.

images/abl.infoToFrom/share-breakers.png

We’re going to add sharing to both Team and Player pages, which requires a Share button and a bit of logic in each page’s ViewModel. You should have copied it into your project at the beginning, but if not, add in a new Share vector asset:

images/abl.infoToFrom/vector-asset-share.png

Then we need to add the Share button to both players and teams. We’ll start with fragment_single_player.xml since it’s the simpler of the ...

Get Kotlin and Android Development featuring Jetpack now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.