Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialNkosinolwazi Moyo
9,588 PointsIntent
Don't know what to do with this coding
1 Answer
Maxwell Newberry
7,693 PointsYou learn to do this in Sending Data to New Activity. The key is in the name of the challenge, Putting Data in an Intent. On line 24, we declare the intent
variable and address our two parameters. The next thing we need to do is "put" our data, or fuel level, to FlightActivity. We can accomplish this using the putExtra()
function where our two parameters, if you remember from the lesson, are (key
, value
). So, if we wanted to pass data, ensure we are on a line below the intent declaration and put the following line:
intent.putExtra("FUEL_LEVEL", fuelLevel);