In most Android apps with multiple activities, you go from the first activity to the second, then the third and so on. Then, if the user touches the back button you go back through the stack one activity at a time. You can remove activities from the back stack or stop them from being placed there at all using either declarations in the manifest or a bit of Java code.
- [Instructor] In most Android apps…with multiple activities,…you go from the first activity to the second,…then the third and so on.…And then if the user touches the back button,…you go back through the stack,…one activity at a time.…As I've described previously,…this is called the back stack.…Each activity is automatically added to the stack,…and then as you go up or back through the hierarchy,…each activity is dropped.…There are times though,…when you want to change that pattern.…To demonstrate some techniques,…I've created a very simple app…that has three activities:…a MainActivity, an Activity2, and an Activity3.…
And the first two activities have buttons…that will navigate to the second and third activities.…Activity 1 has a button to take me to Activity 2,…when I get to Activity 2, I have an up button,…and that'll take me back to the first Activity.…I can go from Activity 2 forward to Activity 3,…and then I can click the up button a couple of times,…go back through the stack.…There's minimal code in each of these activity classes.…
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