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…
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