You are previewing Android: Programming for Developers.
O'Reilly logo
Android: Programming for Developers

Book Description

Develop your own responsive, reactive, and ready-to-deploy Android applications

About This Book

  • Kick-start your Android programming career or just have fun publishing apps to the Google Play marketplace

  • Explore the high-level Android asynchronous constructs available on the Android SDK

  • Learn the internals of a game engine by building one

  • Who This Book Is For

    If you are an iOS developer or any other developer/programmer and you want to try your hands on developing applications on the Android platform, this course is for you. No prior programming experience is needed as this course will guide you right from the beginning to the advanced concepts of Android programming.

    What You Will Learn

  • Mastering the fundamentals of coding Java for Android

  • Installing and setting up your Android development environment

  • Building functional user interfaces with the Android Studio visual designer

  • Adding user interaction, data captures, sound, and animation to your apps

  • Managing your apps’ data using the built-in Android SQLite database

  • Getting familiar with the android process model and low-level concurrent constructs delivered by the Android SDK

  • Interacting with nearby devices over Bluetooth and WiFi communications channels

  • Creating and composing tasks with RxJava to execute complex asynchronous work in a predictable way

  • Handling user inputs, from virtual joysticks to gamepads

  • Implementing collision detection using different techniques and discover how to optimize it for complex games

  • Building, deploying, and publishing real Android applications to the Google Play marketplace

  • In Detail

    Android is the most popular OS in the world. There are millions of devices accessing tens of thousands of applications. It is many people's entry point into the world of technology. The Android: Programming for Developers course will take you on a journey to become an efficient Android programmer by thoroughly understanding the key concepts of Android programming and develop market-ready applications.

    The course begins with helping you create Android applications from scratch. The first module, Android Programming for Beginners, introduces you to all the fundamental concepts of programming in an Android context, from the Java basics to working with the Android API. At the completion of this module, you’ll be ready to start building your own custom applications in Android and Java.

    After getting familiar with the basic programming concepts, the second module, Asynchronous Android Programming, shows you how to make your applications more reliable. This will be achieved using high-level and advanced asynchronous techniques and concepts. Through this module, you will learn to construct scalable and performant applications to take advantage of multi-thread asynchronous techniques.

    With a good grasp on the basics, you move on the final module, Mastering Android Game Development. This progressive module will help you learn to use animations and particle systems to provide a rich experience. By the end of the course, you will create beautiful, responsive, and reusable UIs by taking advantage of the Android SDK.

    Style and approach

    The comprehensive course will run you through the basic concepts for newbies, move on to the UI design, teach you game development on Android, and finally make you proficient in application development on Android. Each of these aspects has been covered in individual modules to help you develop your skills after the completion of a module and get ready for the next.

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

    Table of Contents

    1. Android: Programming for Developers
      1. Table of Contents
      2. Android: Programming for Developers
      3. Android: Programming for Developers
      4. Credits
      5. Preface
        1. What this learning path covers
        2. What you need for this learning path
          1. Windows
          2. Mac OS X
          3. Linux
        3. Who this learning path is for
        4. Reader feedback
        5. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      6. 1. Module 1
        1. 1. The First App
          1. How Java and Android work together
            1. The Android API
            2. Java is object-oriented
            3. What exactly is Android?
          2. The development environment
            1. A note to the existing developers who use Eclipse
            2. The JDK
              1. What if I already have Java?
              2. Installing the JDK
            3. Setting up Android Studio
          3. What makes an Android app
            1. Android resources
            2. The structure of Android's Java code
              1. Android packages
          4. Our first Android app
            1. Creating the project
              1. A note on version controlling
            2. Deploying and testing the app
              1. Deploying to an emulator
              2. Deploying to a real Android device
          5. FAQ
          6. Summary
        2. 2. Java – First Contact
          1. Examining the log output
            1. Exploring the project assets and code
              1. Examining the layout file
          2. Improving our app and deploying again
            1. Modifying the UI
          3. Meet Java
            1. Java comments
              1. Sending messages
            2. Writing our first Java code
              1. Writing our own Java methods
              2. Examining the log output
          4. FAQ
          5. Summary
        3. 3. Exploring Android Studio
          1. The Android Studio guided tour
            1. Parts of the UI
              1. The console
              2. More console features
              3. The project explorer
            2. Transforming the editor into a design studio
              1. E1 – the Preview toolbar
              2. E2 – exploring the palette
              3. E3 – the layout preview
              4. E4 – the Component Tree
              5. E5 – the Properties window
              6. E6 – text and design view tabs
            3. The project folder and file structure
          2. FAQ
          3. Summary
        4. 4. Designing Layouts
          1. Exploring Android UI design
          2. Structure of a UI design
            1. Configuring and using widgets
              1. Widget properties
                1. Setting the size
                  1. Sizing using dp
                  2. Sizing fonts using sp
                  3. Determining size with wrap or match
                2. Using padding and margin
                3. Using the layout_weight property
                4. Using gravity
                5. More properties
              2. Experimenting with widgets
            2. Containing widgets in layouts
              1. RelativeLayout
                1. RelativeLayout in action
              2. Using LinearLayout
          3. Summary
        5. 5. Real-World Layouts
          1. Building a real-world UI
            1. Creating a tablet emulator
            2. List-detail layout with ScrollView and LinearLayout
            3. Designing a form with RelativeLayout
          2. Summary
        6. 6. The Life and Times of an Android App
          1. Introduction to the Android lifecycle
          2. A simplified explanation of the Android lifecycle
          3. Lifecycle phases – what we need to know
          4. Lifecycle phases – what we need to do
          5. The lifecycle demonstration app
            1. Some other overridden methods
          6. The structure of Java code – revisited
          7. Summary
        7. 7. Coding in Java Part 1 – Variables, Decisions, and Loops
          1. Java is everywhere
          2. Syntax and jargon
          3. More code comments
          4. Storing and using data with variables
            1. Types of variables
            2. Primitive types
            3. Reference types
            4. Variable declaration
            5. Variable initialization
          5. Changing values in variables with operators
          6. Expressing yourself demo app
          7. Decisions
            1. Indenting our code
            2. More operators
            3. If they come over the bridge, shoot them
            4. Else do this instead
            5. Switching to make decisions
            6. The Switch Demo app
          8. Repeating code with loops
            1. While loops
              1. Breaking out of a loop
              2. Continue
            2. Do while loops
            3. For loops
            4. Loops demo app
          9. Summary
        8. 8. Coding in Java Part 2 – Methods
          1. Methods revisited
            1. The method structure
              1. Modifiers
              2. Return types
              3. The name of a method
              4. Parameters
              5. Working in the method body
            2. Using methods – demo apps
              1. Real-world methods
              2. Exploring method overloading
          2. Scope and variables revisited
          3. FAQ
          4. Further reading
          5. Summary
        9. 9. Object-Oriented Programming
          1. Important memory management warning
          2. Introducing OOP
            1. What is OOP exactly?
              1. Encapsulation
              2. Polymorphism
              3. Inheritance
            2. Why do it like this?
            3. A class recap
          3. Taking a look at the code for a class
            1. The class implementation
            2. Declaring, initializing, and using an object of the class
          4. The basic classes mini app
            1. More things we can do with our first class
          5. Remember that encapsulation thing?
            1. Controlling class use with access modifiers
              1. Class access in a nutshell
            2. Controlling variable use with access modifiers
              1. Variable access summary
            3. Methods have access modifiers too
              1. A method access summary
            4. Accessing private variables with getters and setters
            5. Setting up our objects with constructors
            6. Static methods
          6. Encapsulation and static methods mini app
          7. OOP and inheritance
          8. The inheritance mini app
          9. Polymorphism
            1. Abstract classes
            2. Interfaces
          10. FAQ
          11. Summary
        10. 10. Everything's a Class
          1. All Android UI elements are classes too
            1. Reintroducing references
              1. A quick break to throw out the trash
              2. Stack and heap – a quick summary
            2. So, how does this heap thing help me?
            3. Using Button and TextView widgets from our layout
            4. Inner and anonymous classes
          2. FAQ
          3. Summary
        11. 11. Widget Mania
          1. Exploring Android UI objects
            1. Declaring and initializing objects
            2. Widget news flash
          2. Exploring the palette
            1. EditText
            2. ImageView
            3. Radio button and group
              1. Anonymous classes
            4. A switch widget
            5. CheckBox
            6. WebView
            7. Date & Time
          3. Android permissions and Marshmallows
            1. Pre-Marshmallow permissions
            2. Marshmallow permissions
            3. The permission solution used in this book
          4. The Widget exploration mini app
            1. Setting up the widget exploration project and UI
            2. Coding the widget exploration app
          5. Summary
        12. 12. Having a Dialogue with the User
          1. Dialog windows
            1. The dialog demo mini project – introducing chaining
          2. About the Note To Self app
            1. Using naming conventions and String resources
            2. How to get the Note To Self code
            3. What we will do and when we will do it
            4. What the user can do
          3. Building the project and gathering resources
            1. Downloading the images
            2. Preparing the String resources
          4. Coding the Note class
          5. Implementing the dialog designs
          6. Coding the dialog boxes
            1. Coding the DialogNewNote class
            2. Coding the DialogShowNote class
            3. Showing our new dialogs
            4. Adding a + icon to the action bar
          7. Summary
        13. 13. Handling and Displaying Arrays of Data
          1. A random diversion
          2. Handling large amount of data with arrays
            1. Arrays are objects
          3. A simple array example mini app
          4. Getting dynamic with arrays
            1. A dynamic array example
          5. Entering the nth dimension with arrays
            1. A multidimensional array mini app
            2. Array out of bounds exceptions
          6. ArrayLists
            1. The enhanced for loop
          7. Arrays and ArrayLists are polymorphic
          8. ListView and BaseAdapter
            1. The problem with displaying lots of widgets
            2. The solution
            3. How to use ListView and BaseAdapter
            4. Inner classes revisited
          9. FAQ
          10. Summary
        14. 14. Handling and Displaying Notes in Note To Self
          1. Note To Self continued
            1. Updating onCreate and preparing the UI
            2. Creating a list item for ListView
          2. Improvements in Note To Self
            1. Persistence
            2. Animation
            3. Sound FX
            4. Problems with the design of the code
          3. FAQ
          4. Summary
        15. 15. Android Intent and Persistence
          1. Good Intents
            1. Switching Activity
            2. Passing data between activities
          2. Adding a settings page to the Note To Self app
            1. Creating SettingsActivity
            2. Designing the Settings screen's layout
            3. Enabling the user to switch to the Settings screen
          3. Persisting data with SharedPreferences
          4. Making the Note To Self app's settings persist
            1. Coding the SettingsActivity class
            2. Coding the MainActivity class
            3. Specifying a parent Activity
          5. More advanced persistence
            1. What is JSON?
            2. Java exceptions - try, catch, and finally
          6. Backing up user data in Note To Self
          7. FAQ
          8. Summary
        16. 16. UI Animations
          1. Animations in Android
            1. Designing cool animations in XML
              1. Fading in and out
              2. Movement
              3. Scaling or stretching
              4. Controlling the duration
              5. Rotating animations
              6. Repeating animations
              7. Combining animation properties with a set tag
            2. Instantiating animations and controlling them with Java code
            3. More animation features
              1. Listeners
              2. Animation interpolators
          2. The Animations Demo app – introducing SeekBar
            1. Laying out the animation demo
            2. Coding the XML animations
            3. Wiring up the Animations Demo app in Java
          3. Adding animations to Note To Self
            1. Defining the animations in XML
            2. Controlling the animations in Java
          4. FAQ
          5. Summary
        17. 17. Sound FX and Supporting Different Versions of Android
          1. Supporting multiple versions of Android
            1. Detecting the current Android version
            2. The SoundPool class
              1. Building SoundPool the new way and the old way
              2. Loading sound files into memory
              3. Playing a sound
              4. Stopping a sound
          2. Introducing the Spinner widget
            1. Making sound FX
            2. Laying out Sound Demo UI
            3. Coding the Sound Demo app
          3. Sound FX touches to Note To Self
          4. Deleting a note – introducing OnLongClick
          5. FAQ
          6. Summary
        18. 18. Design Patterns, Fragments, and the Real World
          1. Introducing the model-view-controller pattern
            1. The model
            2. The view
            3. The controller
          2. The imperfections of Note To Self revisited
          3. Android design guidelines
          4. Real-world apps
          5. The device detection mini app
          6. Configuration qualifiers
          7. Using configuration qualifiers – mini app
            1. The configuration qualifier's summary
          8. Fragments
            1. Fragments have a lifecycle too
              1. onCreate
              2. onCreateView
              3. onAttach and onDetach
              4. onStart, onPause, and onStop
            2. Managing Fragments with FragmentManager
          9. Our first working Fragment mini app
          10. Fragment reality check
          11. FAQ
          12. Summary
        19. 19. Using Multiple Fragments
          1. Using singletons for the model layer
          2. Inter-Fragment communications – interfaces revisited
          3. The dual-Fragment address book mini app
            1. Getting started
            2. Alias resources
            3. The NameAndAddress class
            4. Creating the communication interface
            5. Explaining the structure of the onListItemSelected method
            6. Explaining the code that starts a new Activity
            7. Explaining the code when the detail Fragment is already present
            8. What do we need to do?
            9. Creating the AddressDetailFragment class and layout
            10. Coding PortraitDetailActivity and the layout
          4. FAQ
          5. Summary
        20. 20. Paging and Swiping
          1. Building an image gallery/slider app
            1. Implementing the layout
            2. Coding the PagerAdapter class
            3. Coding the MainActivity class
            4. Running the gallery app
          2. Building a Fragment pager/slider app
            1. Coding the SimpleFragment class
            2. fragment_layout
            3. Coding the MainActivity class
            4. The activity_main layout
            5. Running the Fragment slider app
          3. Summary
        21. 21. Navigation Drawer and Where It's Snap
          1. Introducing the navigation drawer
          2. The Where it's snap app
            1. Preparing the resources
            2. Placeholder code for three Fragments
            3. Coding the MainActivity class and layout
              1. Switching between Fragments
              2. Setting up the drawer
              3. Handling the back button
          3. Summary
        22. 22. Capturing Images
          1. Capturing images using the camera
          2. The capturing images mini app
            1. Adding the camera permission to the manifest
            2. Defining a simple layout
            3. Coding the MainActivity class
            4. Running the Simple Photo app
          3. Where it's snap – coding the capture Fragment
            1. Creating the layout for the capture Fragment
            2. Coding the capture Fragment
            3. Testing the capture Fragment
          4. Summary
        23. 23. Using SQLite Databases in Our Apps
          1. Database 101
            1. What is a database?
            2. What is SQL?
            3. What is SQLite?
          2. The SQL syntax primer
            1. The SQLite example code
              1. Creating a table
              2. Inserting data into the database
              3. Retrieving data from the database
              4. Updating the database structure
          3. The Android SQLite API
            1. SQLiteOpenHelper and SQLiteDatabase
            2. Building and executing queries
            3. Database cursors
          4. The database mini app
            1. Implementing the layout
            2. Coding the database class
            3. Coding MainActivity
            4. Running the mini app
          5. Summary
        24. 24. Adding a Database to Where It's Snap
          1. The Photo class
          2. Handling the SQLite database
          3. Saving a new photo from the capture fragment
          4. Displaying a photo from the database
            1. Preparing the View layout
            2. Coding the ViewFragment class
          5. Coding the communications interface
          6. Coding TitlesFragment
          7. Coding TagsFragment
          8. Coding the fragment communications in MainActivity
          9. Running the app so far
          10. Summary
        25. 25. Integrating Google Maps and GPS Locations
          1. Global Positioning System
          2. Where in the world – the GPS mini app
            1. Where in the world – implementing a simple layout
            2. Coding the Where in the world mini app
            3. Running the Where in the world mini app
          3. The Google Maps mini app
            1. Preparing to connect to Google Maps
              1. Acquiring an API key
              2. Installing the Google Play services API
            2. Coding the maps_activity layout
            3. Coding MapsActivity
            4. Running the Simple Map app
          4. Summary
        26. 26. Upgrading SQLite – Adding Locations and Maps
          1. Adding locations and maps to Where it's Snap
            1. Updating the database
              1. Adding member variables to represent location data
              2. Updating the database version
              3. Adding code in onUpgrade to upgrade the database for existing users
              4. Updating the database creation code in onCreate for new users
              5. Updating the addPhoto method to handle GPS coordinates
            2. Updating the Photo class
            3. Updating CaptureFragment
          2. Updating ViewFragment
          3. Adding location permissions
          4. Testing the new map feature
          5. Summary
        27. 27. Going Local – Hola!
          1. The Localization mini app
            1. Preparing the layout
            2. Preparing the first strings.xml file
            3. Making the app multilingual with the second strings.xml file
            4. Adding a third language
            5. Running the app
          2. Localizing the Where it's snap app
          3. Summary
        28. 28. Threads, Touches, Drawing, and a Simple Game
          1. Threads
          2. Problems with threads
          3. Drawing with canvas and paint
            1. The Android coordinate system
          4. Android Canvas demo app
          5. Handling touches
          6. A simple game engine
          7. Building a simple game of Pong
            1. Adding sound files to the project
            2. Coding the ball
            3. Coding the paddle
            4. Coding MainActivity
            5. Coding SurfaceView
              1. Coding the update method
              2. Coding the draw method
            6. Lock the screen orientation and make it full-screen
            7. Running the game
            8. Pong enhancements
          8. Summary
        29. 29. Publishing Apps
          1. Preparing to publish
            1. Creating an app icon
            2. Preparing the required resources
          2. Building the publishable APK file
          3. Publishing the app
          4. Marketing
          5. More to see
          6. Summary
      7. 2. Module 2
        1. 1. Asynchronous Programming in Android
          1. Android software stack
            1. Dalvik runtime
            2. ART runtime
            3. Memory sharing and Zygote
          2. Android process model
            1. Process ranks
            2. Process sandboxing
          3. Android thread model
            1. The main thread
            2. The Application Not Responding (ANR) dialog
            3. Maintaining responsiveness
          4. Concurrency in Android
            1. Correctness issues in concurrent programs
            2. Liveness issues in concurrent programs
            3. Thread coordination
            4. Concurrent package constructs
              1. Executor framework
          5. Android primary building blocks
            1. Activity concurrent issues
            2. Manipulating the user interface
            3. Service concurrent issues
            4. Started services issues
            5. Bound services issues
          6. Service in a separate process
            1. Broadcast receiver concurrent issues
            2. Android concurrency constructs
          7. Summary
        2. 2. Performing Work with Looper, Handler, and HandlerThread
          1. Understanding Looper
            1. Understanding Handler
            2. Sending work to a Looper
            3. Scheduling work with post
            4. Using Handler to defer work
            5. Leaking implicit references
            6. Leaking explicit references
            7. Updating the UI with Handler
            8. Canceling a pending Runnable
            9. Scheduling work with send
            10. Cancelling pending messages
            11. Composition versus inheritance
            12. Multithreading with Handler and ThreadHandler
              1. Looper message dispatching debugging
            13. Sending messages versus posting runnables
            14. Applications of Handler and HandlerThread
          2. Summary
        3. 3. Exploring the AsyncTask
          1. Introducing AsyncTask
          2. Declaring AsyncTask types
          3. Executing AsyncTasks
          4. Providing indeterministic progress feedback
          5. Providing deterministic progress feedback
          6. Canceling an AsyncTask
            1. AsyncTask Execution State
          7. Handling exceptions
          8. Controlling the level of concurrency
          9. Common AsyncTask issues
            1. Fragmentation issues
            2. Memory leaks
            3. Activity lifecycle issues
              1. Handling lifecycle issues with early cancellation
              2. Handling lifecycle issues with retained headless fragments
          10. Applications of AsyncTask
          11. Summary
        4. 4. Exploring the JobScheduler API
          1. Introduction to JobScheduler
          2. Setting running criteria
          3. Scheduling a job
          4. Implementing the JobService
          5. Listing pending jobs
          6. Canceling a job
          7. Scheduling a periodic job
          8. Applications of the JobScheduler
          9. Summary
        5. 5. Interacting with the Network
          1. Introducing Android HTTP clients
            1. AndroidHttpClient
            2. HttpURLConnection
          2. Performing HTTP requests asynchronously
            1. Retrieving a text response
            2. Interacting with JSON web APIs
              1. Converting Java objects to JSON
            3. Interacting with XML web APIs
              1. Converting Java objects to XML
              2. Converting XML to Java objects
          3. Customizing HTTP timeouts
          4. Communicating securely over SSL sessions
          5. Summary
        6. 6. Network Interactions with GCM
          1. Introduction to GCM
          2. Setting up and configuring GCM for your application
            1. Registering the GCM Receiver
            2. Setting up a registration service
            3. InstanceID listener
          3. Receiving downstream messages
          4. Receiving messages from topic
          5. Sending upstream messages
          6. GcmListenerService delivery callbacks
          7. Executing tasks with GCM Network Manager
            1. Building a one shot task
          8. Summary
        7. 7. Asynchronous Programing with RxJava
          1. Introduction to RxJava
            1. Cold versus Hot Observable
          2. RxJava setup
          3. Creating Observables
          4. Transforming Observables
          5. Understanding Schedulers
          6. Performing IO operations with Schedulers
          7. Canceling subscriptions
          8. Composing Observables
          9. Monitoring the event stream
          10. Combining Observables
          11. Observing UI Events with RxJava
          12. Working with Subjects
          13. Summary
      8. 3. Module 3
        1. 1. Setting Up the Project
          1. The right tool for the right game
            1. Do you want to use 3D?
            2. Do you want to use physics?
            3. Do you want to use Java?
            4. Pros of building games with the Android SDK
            5. Cons of building games with the Android SDK
            6. I want the Android SDK!
          2. The project – YASS (Yet Another Space Shooter)
            1. Activities and Fragments
            2. Project setup
              1. Creating the stub project
              2. Cleaning up
            3. Choosing an orientation
              1. Dealing with aspect ratios
          3. Game architecture
            1. GameEngine and GameObjects
              1. Starting a game
              2. Stopping a game
              3. Managing game objects
            2. UpdateThread
            3. DrawThread
            4. User input
          4. Putting everything together
          5. Moving forward with the example
            1. Handling the back key
            2. Honoring the lifecycle
            3. Using as much screen as we can
              1. Before Android 4.4 – almost fullscreen
              2. Android 4.4 and beyond – immersive mode
              3. Putting fullscreen together
          6. Good practices for game developers
            1. Object pools
            2. Avoiding enhanced loop syntax in lists
            3. Precreating objects
            4. Accessing variables directly
            5. Being careful with floating points
            6. Performance myths – avoid interfaces
          7. Summary
        2. 2. Managing User Input
          1. The InputController base class
            1. The Player object
              1. Displaying a spaceship
              2. Firing bullets
            2. The Bullet game object
          2. The most basic virtual keypad
            1. Limitations and problems
          3. Creating a virtual joystick
            1. General considerations and improvements
          4. Physical controllers
            1. Handling MotionEvents
            2. Handling KeyEvents
            3. Detecting gamepads
          5. Sensors and InputControllers
          6. Selecting control modes
          7. Summary
        3. 3. Into the Draw Thread
          1. Using GameView
            1. The GameView interface
            2. StandardGameView
            3. SurfaceGameView
            4. Updating GameEngine
            5. Updating the game layout
          2. Improving DrawThread
          3. Sprites
            1. Updating the spaceship and bullets
          4. Adding a frames-per-second (fps) counter
          5. Spawning enemies – the GameController
            1. Procedural/random
            2. Deterministic/static
            3. Hybrid approach
            4. Our approach
            5. The asteroids
              1. More on the transformation matrix
          6. Occlusion culling
          7. Parallax backgrounds
            1. Multiple backgrounds
          8. Layers
          9. Summary
        4. 4. Collision Detection
          1. Detecting collisions
            1. Who can collide?
            2. Updating GameEngine
            3. Handling collisions
          2. Rectangular bodies
            1. Adding visual feedback
            2. Pros and cons
          3. Circular bodies
            1. Adding visual feedback
            2. Pros and cons
          4. Mixed collision detection
            1. Adding visual feedback
            2. Other options for shapes
            3. Optimization
            4. Spatial partitioning and QuadTree
              1. Duplicated collisions
          5. Summary
        5. 5. Particle Systems
          1. General concepts
            1. Particles
            2. ParticleSystem
            3. Initializers
            4. Modifiers
            5. Composite GameObjects and GameEngine
          2. Making good particle systems
          3. One shot
            1. Asteroid explosions
            2. Spaceship explosions
          4. Emitters
            1. Asteroid trails
            2. The spaceship's engine
          5. Summary
        6. 6. Menus and Dialogs
          1. Custom fonts
          2. Working with backgrounds
            1. The power of XML drawables
            2. State list drawables
              1. State lists colors
            3. Shape drawables
          3. The GameFragment
            1. Adding a score
            2. Adding lives
          4. Custom dialogs
            1. BaseCustomDialog
            2. Quit dialog
            3. Pause dialog
            4. Game Over dialog
            5. Other dialogs
          5. Designing for multiple screen sizes
          6. Summary
        7. 7. To the Big Screen
          1. Project configuration
          2. Testing for Android TV
          3. Declaring a TV Activity
          4. Providing a home screen banner
          5. Declaring it as a game
            1. Declaring Leanback support
            2. Declaring touchscreen capability as not required
          6. Reviewing the manifest
          7. Showing controller instructions
            1. Dealing with overscan
            2. Controller-based navigation
            3. Dialogs and controllers
          8. Beyond this book
          9. Summary
      9. A. Bibliography
      10. Index