Menus

The top-right area of the toolbar is reserved for the toolbar’s menu. The menu consists of action items (sometimes also referred to as menu items), which can perform an action on the current screen or to the app as a whole. You will add an action item to allow the user to create a new crime.

Your menu will require a few string resources. Add them to strings.xml (Listing 13.5) now. These strings may seem mysterious at this point, but it is good to get them taken care of. When you need them later, they will already be in place, and you will not have to stop what you are doing to add them.

Listing 13.5  Adding strings for menus (res/values/strings.xml)

<​r​e​s​o​u​r​c​e​s​>​ ​ ​.​.​.​ ​ ​<​s​t​r​i​n​g​ ​n​a​m​e​=​"​d​a​t​e​_​p​i​c​k​e​r​_​t​i​t​l​e​"​>​D​a​t​e​ ...

Get Android Programming: The Big Nerd Ranch Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.