In addition to the standard lifecycle events, there are many other kinds of events that can occur in Android apps. You can respond to most of them in the same way—by overriding and customizing callback methods. One of the most important events occurs when a mobile device’s orientation changes, from portrait to landscape and back again. This is one of many changes that can occur that are known as configuration changes.
- [Instructor] In addition…to the standard life cycle events,…there are many other kinds of events…that can occur in Android apps.…You respond to most of them in the same way…by overriding and customizing callback methods.…One of the most important events occurs…when a mobile device's orientation changes…from portrait to landscape and back again.…Each time this happens,…an activity goes through the whole life cycle.…The existing activity instance is paused…and then destroyed,…and then a new instance is created and resumed.…
In this version of my Code Runner application,…I'm outputting information for each life cycle event,…and when I change the orientation,…you'll see a pause and a resume occur,…and then when I go back to portrait, it happens again.…The orientation change is just one sort…of configuration change,…and you can learn about all the different kinds…of configuration changes at this web page…named handling configuration changes.…But I'll show you how to handle this most important one,…how to save information as an activity is closing down…
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