You've seen how to send information from one activity to another with an intent object. You can also return information from a secondary activity to its caller, by passing back a result.
- [Instructor] I've previously described…how to set data to an activity.…You can also return results in the reverse direction,…from a secondary activity to a parent activity.…You do this by starting the activity…slightly differently, and setting up…something called a requestCode.…I'll demonstrate this in the project Return Results.…First, I'll need some more constants.…I'll place the cursor at the top of the class.…I'm going to use a live template called psf.…
That stands for public static final,…and expands when I press the tab key.…And I'll set this up as an integer constant.…And I'll name it EMAIL_REQUEST.…And I'll give it a value of 1000.…The number doesn't matter, it can be anything.…Now, I'm going to be passing back two values…from the email data entry screen.…A name and an email.…So I'll move down here and I'll create…another constant with psfs this time.…That expands to public static final string.…
And I'll call this one EMAIL_KEY.…And I'll give it a value of email_key, lowercase.…The values of these constants don't matter at all.…
Looking for study partners?Join the Associate Android Developer Exam study group
Once you've created your Android application and designed a user interface, you're ready to learn how to manage your app. This course prepares you to handle events and manage navigation in your Android app. David Gassner begins by explaining how to work with events. He describes the activity lifecycle—what actually happens when a screen appears and disappears—and shares some techniques for working with events using Java objects, lambda expressions, and open source libraries. Next, he covers how to manage navigation, start activities with explicit intents, send data to an activity, and open other apps with implicit intents.
David also shows how to send and receive broadcast messages that let you exchange data and notifications among the different tiers of your application. He demonstrates how to work with menus and the action bar, add a navigation drawer to a layout, and tackle advanced navigation techniques. Later courses in the Essentials series concentrate on other specific skills you can master.
- Working with events
- Handling events with Java objects and lambda expressions
- Managing navigation
- Sending data to an activity
- Opening other apps with implicit intents
- Sending and receiving broadcast messages
- Working with menus and the action bar
- Adding a navigation drawer
- Advanced navigation techniques
- Removing activities from the back stack