Android 9 Development Cookbook - Third Edition

Android 9 Development Cookbook - Third Edition

Read it now on the O’Reilly learning platform with a 10-day free trial.

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

Book description

Build feature-rich, reliable Android Pie apps with the help of more than 100 proven industry standard recipes and strategies.

Key Features

Book Description

The Android OS has the largest installation base of any operating system in the world. There has never been a better time to learn Android development to write your own applications, or to make your own contributions to the open source community! With this extensively updated cookbook, you'll find solutions for working with the user interfaces, multitouch gestures, location awareness, web services, and device features such as the phone, camera, and accelerometer. You also get useful steps on packaging your app for the Android Market. Each recipe provides a clear solution and sample code you can use in your project from the outset. Whether you are writing your first app or your hundredth, this is a book that you will come back to time and time again, with its many tips and tricks on the rich features of Android Pie.

What you will learn

Who this book is for

If you are new to Android development and want to take a hands-on approach to learning the framework, or if you are an experienced developer in need of clear working code to solve the many challenges in Android development, you will benefit from this book. Either way, this is a resource you'll want to keep on your desk as a quick reference to help you solve new problems as you tackle more challenging projects.

Show and hide more Table of contents Product information

Table of contents

  1. Title Page
  2. Copyright and Credits
    1. Android 9 Development Cookbook Third Edition
    1. Why subscribe?
    2. Packt.com
    1. About the author
    2. About the reviewers
    3. Packt is searching for authors like you
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
      5. See also
      1. Reviews
      1. Introduction
      2. Declaring an activity
        1. Getting ready
        2. How to do it.
        3. How it works.
        1. Getting ready
        2. How to do it.
        3. How it works.
        4. There's more.
        5. See also
        1. Getting ready
        2. How to do it.
        3. How it works.
        4. See also
        1. Getting ready
        2. How to do it.
        3. How it works.
        4. There's more.
        1. Getting ready
        2. How to do it.
        3. How it works.
        4. There's more.
        5. See also
        1. Getting ready
        2. How to do it.
        3. How it works.
        4. There's more.
        5. See also
        1. Getting ready
        2. How to do it.
        3. How it works.
        4. There's more.
          1. Using more than one preference file
          1. Getting ready
          2. How to do it.
          3. How it works.
          4. There's more.
          1. Introduction
          2. Defining and inflating a layout
            1. Getting ready
            2. How to do it.
            3. How it works.
            4. There's more.
            5. See also
            1. Getting ready
            2. How to do it.
            3. How it works.
            4. There's more.
            5. See also
            1. Getting ready
            2. How to do it.
            3. How it works.
            4. There's more.
            5. See also
            1. Getting ready
            2. How to do it.
            3. How it works.
            4. There's more.
            1. Getting ready
            2. How to do it.
            3. How it works…
            4. There’s more…
            1. Getting ready
            2. How to do it.
            3. How it works.
            1. Introduction
            2. Inserting a widget into a layout
              1. Getting ready
              2. How to do it.
              3. How it works.
              4. There's more.
              5. See also
              1. Getting ready
              2. How to do it.
              3. How it works.
              4. There's more.
                1. Using designated folders for screen-specific resources
                1. Getting ready
                2. How to do it.
                3. How it works.
                4. There's more.
                1. Getting ready
                2. How to do it.
                3. How it works.
                4. There's more.
                5. See also
                1. Getting ready
                2. How to do it.
                3. How it works.
                4. There's more.
                5. See also
                1. Getting ready
                2. How to do it.
                3. How it works.
                4. There's more.
                1. Getting ready
                2. How to do it.
                3. How it works.
                4. There's more.
                1. Introduction
                2. Creating an options menu
                  1. Getting ready
                  2. How to do it.
                  3. How it works.
                  4. There's more.
                    1. Using a menu item to launch an activity
                    2. Creating submenus
                    3. Grouping menu items
                    1. Getting ready
                    2. How to do it.
                    3. How it works.
                    4. There's more.
                    1. Creating a floating context menu
                    2. Getting ready
                    3. How to do it.
                    4. How it works.
                    5. There's more.
                    6. See also
                    1. Getting ready
                    2. How to do it.
                    3. How it works.
                    4. There's more.
                    5. See also
                    1. Getting ready
                    2. How to do it.
                    3. How it works.
                    1. Introduction
                    2. Creating and using a Fragment
                      1. Getting ready
                      2. How to do it.
                      3. How it works.
                      4. There's more.
                      5. See also
                      1. Getting ready
                      2. How to do it.
                      3. How it works.
                      4. There's more.
                      5. See also
                      1. Getting ready
                      2. How to do it.
                      3. How it works.
                      4. There's more.
                      5. See also
                      1. Getting ready
                      2. How to do it.
                      3. How it works.
                      4. There's more.
                      1. Introduction
                      2. Creating a shortcut on the Home screen
                        1. Getting ready
                        2. How to do it.
                        3. How it works.
                        4. There's more.
                        1. Getting ready
                        2. How to do it.
                        3. How it works.
                        4. There's more.
                        5. See also
                        1. Getting ready
                        2. How to do it.
                        3. How it works.
                        4. See also
                        1. Getting ready
                        2. How to do it.
                        3. How it works.
                        4. There's more.
                          1. Sticky Immersion
                          2. Dimming the System UI
                          3. Setting the Action Bar as an overlay
                          4. Translucent system bars
                          1. Introduction
                          2. Storing simple data
                            1. Getting ready
                            2. How to do it.
                            3. How it works.
                            4. There's more.
                            1. Getting ready
                            2. How to do it.
                            3. How it works.
                            4. There's more.
                              1. Caching files
                              1. Getting ready
                              2. How to do it.
                              3. How it works.
                              4. There's more.
                                1. Getting public folders
                                2. Checking available space
                                3. Deleting a file
                                4. Working with directories
                                5. Preventing files from being included in galleries
                                1. Getting ready
                                2. How to do it.
                                3. How it works.
                                4. There's more.
                                5. See also
                                1. Getting ready
                                2. How to do it.
                                3. How it works.
                                4. There's more.
                                  1. Upgrading a database
                                  1. Getting ready
                                  2. How to do it.
                                  3. How it works.
                                  4. There's more.
                                  5. See also
                                  1. Getting ready
                                  2. How to do it.
                                  3. How it works.
                                  4. There's more.
                                  5. See also
                                  1. Introduction
                                  2. Lights, Action, and Sound – getting the user's attention!
                                    1. Getting ready
                                    2. How to do it.
                                    3. How it works.
                                    4. There's more.
                                    5. See also
                                    1. Getting ready
                                    2. How to do it.
                                    3. How it works.
                                    4. See also
                                    1. Getting ready
                                    2. How to do it.
                                    3. How it works.
                                    4. There's more.
                                      1. Add an icon
                                      2. Using a list
                                      3. Custom layout
                                      1. Getting ready
                                      2. How to do it.
                                      3. How it works.
                                      4. There's more.
                                      1. Getting ready
                                      2. How to do it.
                                      3. How it works.
                                      4. There's more.
                                        1. Adding a button to the notification using addAction()
                                        2. Expanded notifications
                                        3. Lock screen notifications
                                        1. Getting ready
                                        2. How to do it.
                                        3. How it works.
                                        4. There's more.
                                        5. See also
                                        1. Getting ready
                                        2. How to do it.
                                        3. How it works.
                                        4. There's more.
                                        5. See also
                                        1. Getting ready
                                        2. How to do it.
                                        3. How it works.
                                        4. See also
                                        1. Introduction
                                        2. Listening for click and long-press events
                                          1. Getting ready
                                          2. How to do it.
                                          3. How it works.
                                          4. There's more.
                                          1. Getting ready
                                          2. How to do it.
                                          3. How it works.
                                          4. There's more.
                                          5. See also
                                          1. Getting ready
                                          2. How to do it.
                                          3. How it works.
                                          1. Getting ready
                                          2. How to do it.
                                          3. How it works.
                                          4. There's more.
                                          1. Getting ready
                                          2. How to do it.
                                          3. How it works.
                                          4. There's more.
                                          5. See also
                                          1. Getting ready
                                          2. How to do it.
                                          3. How it works.
                                          4. There's more.
                                            1. Environment sensors
                                            2. Position sensors
                                            3. Motion sensors
                                            1. Getting ready
                                            2. How to do it.
                                            3. How it works.
                                            4. There's more.
                                              1. Getting current device rotation
                                              1. Introduction
                                              2. Scaling down large images to avoid Out of Memory exceptions
                                                1. Getting ready
                                                2. How to do it.
                                                3. How it works.
                                                4. There's more.
                                                5. See also
                                                1. Getting ready
                                                2. How to do it.
                                                3. How it works.
                                                4. There's more.
                                                5. See also
                                                1. Getting ready
                                                2. How to do it.
                                                3. How it works.
                                                4. There's more.
                                                5. See also
                                                1. Getting ready
                                                2. How to do it.
                                                3. How it works.
                                                4. There's more.
                                                  1. Creating a Setup Wizard
                                                  1. Getting ready
                                                  2. How to do it.
                                                  3. How it works.
                                                  4. See also
                                                  1. Getting ready
                                                  2. How to do it.
                                                  3. How it works.
                                                  4. There's more.
                                                    1. Getting the default animation duration
                                                    1. Getting ready
                                                    2. How to do it.
                                                    3. How it works.
                                                    4. See also
                                                    1. Getting ready
                                                    2. How to do it.
                                                    3. How it works.
                                                    4. There's more.
                                                    5. See also
                                                    1. Introduction
                                                    2. Setting up the OpenGL ES environment
                                                      1. Getting ready
                                                      2. How to do it.
                                                      3. How it works.
                                                        1. Declaring OpenGL in the Android Manifest
                                                        2. Extending the GLSurfaceView class
                                                        3. Creating an OpenGL rendered class
                                                        1. Getting ready
                                                        2. How to do it.
                                                        3. How it works.
                                                        4. There's more.
                                                        5. See also
                                                        1. Getting ready
                                                        2. How to do it.
                                                        3. How it works.
                                                        4. There's more.
                                                        1. Getting ready
                                                        2. How to do it.
                                                        3. How it works.
                                                        4. There's more.
                                                          1. The render mode
                                                          1. Getting ready
                                                          2. How to do it.
                                                          3. How it works.
                                                          4. There's more.
                                                          5. See also
                                                          1. Introduction
                                                          2. Playing sound effects with SoundPool
                                                            1. Getting ready
                                                            2. How to do it.
                                                            3. How it works.
                                                            4. There's more.
                                                            5. See also
                                                            1. Getting ready
                                                            2. How to do it.
                                                            3. How it works.
                                                            4. There's more.
                                                              1. Playing music in the background
                                                              2. Using hardware volume keys to control your app's audio volume
                                                              1. Getting ready
                                                              2. How to do it.
                                                              3. How it works.
                                                              4. There's more.
                                                                1. Checking the hardware type
                                                                1. Getting ready
                                                                2. How to do it.
                                                                3. How it works.
                                                                4. There's more.
                                                                  1. Calling the default video app
                                                                  1. Getting ready
                                                                  2. How to do it.
                                                                  3. How it works.
                                                                    1. Setting up the camera preview
                                                                    2. Capturing the image
                                                                    1. Introduction
                                                                    2. How to make a phone call
                                                                      1. Getting ready
                                                                      2. How to do it.
                                                                      3. How it works.
                                                                      4. See also
                                                                      1. Getting ready
                                                                      2. How to do it.
                                                                      3. How it works.
                                                                      4. There's more.
                                                                      5. See also
                                                                      1. Getting ready
                                                                      2. How to do it.
                                                                      3. How it works.
                                                                      4. There's more.
                                                                        1. Multipart messages
                                                                        2. Delivery status notification
                                                                        1. Getting ready
                                                                        2. How to do it.
                                                                        3. How it works.
                                                                        4. There's more.
                                                                          1. Reading existing SMS messages
                                                                          1. Getting ready
                                                                          2. How to do it.
                                                                          3. How it works.
                                                                          4. There's more.
                                                                            1. Controlling page navigation
                                                                            2. How to enable JavaScript
                                                                            3. Enable built-in zoom
                                                                            1. Getting ready
                                                                            2. How to do it.
                                                                            3. How it works.
                                                                            4. There's more.
                                                                              1. Monitoring network state changes
                                                                              1. Getting ready
                                                                              2. How to do it.
                                                                              3. How it works.
                                                                              4. There's more.
                                                                              5. See also
                                                                              1. Introduction
                                                                              2. How to get the device location
                                                                                1. Getting ready
                                                                                2. How to do it.
                                                                                3. How it works.
                                                                                4. There's more.
                                                                                  1. Mock locations
                                                                                  1. Getting ready
                                                                                  2. How to do it.
                                                                                  3. How it works.
                                                                                  4. There's more.
                                                                                  5. See also
                                                                                  1. Getting ready
                                                                                  2. How to do it.
                                                                                  3. How it works.
                                                                                  4. There's more.
                                                                                  5. See also
                                                                                  1. Introduction
                                                                                  2. The Android 6.0 Runtime Permission Model
                                                                                    1. Getting ready
                                                                                    2. How to do it.
                                                                                    3. How it works.
                                                                                    4. There's more.
                                                                                    5. See also
                                                                                    1. Getting ready
                                                                                    2. How to do it.
                                                                                    3. How it works.
                                                                                    4. There's more.
                                                                                      1. Cancel the alarm
                                                                                      2. Repeating alarm
                                                                                      1. Getting ready
                                                                                      2. How to do it.
                                                                                      3. How it works.
                                                                                      4. There's more.
                                                                                      5. See also
                                                                                      1. Getting ready
                                                                                      2. How to do it.
                                                                                      3. How it works.
                                                                                      4. There's more.
                                                                                        1. Parameter types
                                                                                        2. Canceling the task
                                                                                        1. Getting ready
                                                                                        2. How to do it.
                                                                                        3. How it works.
                                                                                        4. There's more.
                                                                                        5. See also
                                                                                        1. Getting ready
                                                                                        2. How to do it.
                                                                                        3. How it works.
                                                                                        4. There's more.
                                                                                        5. See also
                                                                                        1. Introduction
                                                                                        2. How to create an Android project with Kotlin
                                                                                          1. Getting ready
                                                                                          2. How to do it.
                                                                                          3. How it works.
                                                                                          4. There's more.
                                                                                          5. See also
                                                                                          1. Getting ready
                                                                                          2. How to do it.
                                                                                          3. How it works.
                                                                                          4. See also
                                                                                          1. Getting ready
                                                                                          2. How to do it.
                                                                                          3. How it works.
                                                                                          4. See also
                                                                                          1. Leave a review - let other readers know what you think
                                                                                          Show and hide more

                                                                                          Product information

                                                                                          • Title: Android 9 Development Cookbook - Third Edition
                                                                                          • Author(s): Rick Boyer
                                                                                          • Release date: October 2018
                                                                                          • Publisher(s): Packt Publishing
                                                                                          • ISBN: 9781788991216