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

Presenting information inside the WatchFace class


In this section, we will proceed to create our custom WatchFace class that will be used to invoke the methods within the watch face service and this class will be responsible for allocating and initializing the resources that our watch face requires.

First, we need to create a new class called CustomWatchFace, as follows:

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

  2. Next, right-click and choose the New | Java Class menu option.

  3. Then, enter CustomWatchFace to be used as the name for our class and click on the OK button to open the Android Studio code editor window.

    Our next step is to write the code that will communicate with our Android wearable device. For this, we will need to create a new class that will act as our watch service.

  4. Open CustomWatchFace.java as shown in the preceding screenshot.

  5. Next, enter the import statements as shown in the following code snippet:

    import android.content.Context...