Skip to Content
Android 9 Development Cookbook - Third Edition
book

Android 9 Development Cookbook - Third Edition

by Rick Boyer
October 2018
Intermediate to advanced
464 pages
15h 17m
English
Packt Publishing
Content preview from Android 9 Development Cookbook - Third Edition

How to do it...

With the new project created as described in the preceding section, you are ready to create a menu. First, we will add a string resource to strings.xml. We will use the new string for the menu title when we create the XML for the menu. Here are the steps:

  1. Start by opening the strings.xml file and adding the following <string> element to the <resources> element:
    <string name="menu_settings">Settings</string> 
  1. Create a new file in the res/menu directory and call it menu_main.xml.
  1. Open the menu_main.xml file and add the following XML to define the menu:
    <?xml version="1.0" encoding="utf-8"?>    <menu xmlns:android="http://schemas.android.com/apk/res/android"        xmlns:app="http://schemas.android.com/apk/res-auto">        <item android ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Android Application Development Cookbook - Second Edition

Android Application Development Cookbook - Second Edition

Rick Boyer, Kyle Mew
Android High Performance Programming

Android High Performance Programming

Enrique López Mañas, Diego Grancini
Android Things Projects

Android Things Projects

Francesco Azzola

Publisher Resources

ISBN: 9781788991216Supplemental Content