From the course: Android Development: Understanding Intents

Unlock the full course today

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

Intent extra values

Intent extra values - Android Tutorial

From the course: Android Development: Understanding Intents

Start my 1-month free trial

Intent extra values

- [Instructor] Of course, intents wouldn't be all that useful if all we could do was just use them to start other activities. You can store additional data in an intent object, which can then be extracted and parsed by the receiving component. So let's go back and modify our example to show how to do this. And we already got a peak at the beginning of this example, when we built our implicit intent to send a piece of text data to another app. So here in our code, I'm going to modify our example to add some information to the intent we created earlier, to launch our destination activity. So as we saw with the implicit intent example, the putExtra method is used to store extra data items in the intent, itself. So when I type putExtra, you can see that there are several versions of this function which accept different kinds of data. Such as integers and strings and Booleans and objects and so on. So to keep his example simple, I'm just going to send two pieces of data which will be…

Contents