O'Reilly logo

Mastering Android Wear Application Development by Javeed Chida, Siddique Hameed

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

New feature - tracking our steps

Everyone loves step counters. How about we build one for our wearable device? Not much to talk about here, so let's dive into the code.

Add to-do item - a new action in the wearable app

The first thing we will do here is to add a menu item to the wearable app. Let's call it Step Count. Our changes to arrays.xml file would be as follows:

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <string-array name="actions"> 
        <item>Day of Year</item> 
        <item>On this day...</item> 
        <item>Add Todo Item</item> 
        <item>Step Count</item> 
    </string-array> 
</resources> 

This action should now show up on the wearable app, as shown in the following figure:

Click on the Step Count menu item to launch the corresponding StepCounterActivity

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required