Book Image

Android Wearable Programming

By : Steven F. Daniel
Book Image

Android Wearable Programming

By: Steven F. Daniel

Overview of this book

Table of Contents (14 chapters)
Android Wearable Programming
Credits
About the Authors
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Customizing the Android TV user interface


In this section, we will begin by creating a custom header and custom row fragment for our Android TV user interface. The previously generated code that handles the displaying of header and row information currently exists within the MainFragment class.

In the sections that follow, we will be taking a look at how we can separate this information into two individual classes, which will make the code easier to maintain.

Creating the CustomHeadersFragment class

In this section, we will proceed to create our CustomHeadersFragment class that inherits from the HeadersFragment class and will be used to display our list of categories within the side panel of our Android TV user interface.

First, we need to create a new class called CustomHeadersFragment:

  1. From the Project Navigator window, expand the app section, select and expand the java section.

  2. Next, right-click and choose the New | Fragment | Fragment (Blank) menu option:

  3. Then, enter CustomHeadersFragment to...