From the course: Android Development Essential Training: App Architecture with Kotlin

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Share data with implicit intents

Share data with implicit intents - Android Tutorial

From the course: Android Development Essential Training: App Architecture with Kotlin

Start my 1-month free trial

Share data with implicit intents

- [Instructor] My secondary activity in this app, what I'm calling my dice activity, is currently displaying a share button out the top right corner, but right now it doesn't do anything. Each time the user presses that button though a function is called automatically by the application framework called on options item selected. And you can handle those events by overriding that function. At the bottom of my class I'll start typing the name of the function and I'll select it. And then I'll add some code here before the return statement. I'll add a return when expression and I'll examine this expression, item question mark dot item ID. I need the question mark there because the menu item is a nullable type. The item ID will have one of the values from the menu items. Right now my menu only has one ID, action share, so I'll look for that. I'll add some braces and then I'll look for R dot ID dot action underscore share. I'll add the arrow operator and I'll call a function that I haven't…

Contents