From the course: Android Development Essential Training: Your First App with Kotlin
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Send an action to a new activity - Android Tutorial
From the course: Android Development Essential Training: Your First App with Kotlin
Send an action to a new activity
- [Narrator] When you load a new activity with an intent, you can share data with the new activity in a number of ways. To demonstrate this, I've rebuilt this application a bit. The main activity is much simpler than before in terms of code, but in its content layout file, I'll jump to that file here, I've added four buttons, each displaying an image. These are using a particular kind of component called an image button. And you can see in the text, that I'm referring to the image that I want to display right down here in the source attribute. The first button has an ID and source of monster01, the second of monster02, and so on. When the user touches or clicks one of these buttons, I want to jump to the detail activity, and display the selected image full screen. Now to respond to those clicks, or touches, I'm going to refer to the ID of the button. I'll start here in the main activities on create function, and I'll choose monster01 from content main. When I choose that ID, I'm…
Contents
-
-
-
-
-
-
(Locked)
Define screens with activities4m 2s
-
(Locked)
Implement designs in XML layouts3m 59s
-
(Locked)
Use the View and ViewGroup components3m 28s
-
(Locked)
Display an image in an activity4m 36s
-
Convert PNG and SVG image files3m 48s
-
(Locked)
Start new activities with intents4m 25s
-
(Locked)
Send an action to a new activity4m 32s
-
(Locked)
Send data URIs and extras with intents6m 50s
-
(Locked)
Handle shared data with an intent filter5m 39s
-
(Locked)
-