Items that appear on the toolbar, or action bar, are actually part of the options menu. You define them in the same XML menu file as the other items, and add an attribute to indicate how you want them displayed.
- [Instructor] In an Android app,…graphics that appear on the action bar, or toolbar,…are actually a part of the options menu.…You define them in the same XML menu file as other items,…or create them at Runtime with Java code,…and you add an attribute to indicate…how you want them displayed on the action bar,…instead of in the menu.…Let's say that you wanted to move this functionality,…the functionality that happens…when the user clicks on display map,…to the top, to the action bar.…First, you would need to add an options menu,…and add a single item,…and designate it as an action bar item.…
And then, you can add an icon so it appears…as a graphical symbol instead of as text.…In this version of my Nadia's Restaurant application,…I've added a menu file to a menu resources folder,…and it has an item in it with an ID of action_map,…and a title of display_map.…But it's not being displayed in the application yet.…I'll go to the main activity and show…that there's also an implementation…of onCreateOptions menu.…
And a bit of code that's commented out…
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