Hello, this is YOSHIMURA, researching on wearable devices at ATL. This time, we are going to make a prototype of the timer with Android.


Here we divide the architectures into two parts as in a theory; for a main screen Activity + custom a href=”http://developer.android.com/reference/android/view/View.html” title=”View | Android Developers”>View, and for time tracking and making a sound Service.

Making a main screen

Let’s make another custom view to avoid the concentration of logic in Activity.

Making a time view

We are going to make TimerView.

First, center the layout with TextView. Make sure you explicitly specify Roboto by using the fontFamily property.


Let me write down a minimum logic.



If you preview this, it will look like this below.


Making Activity

Once you have finished those, set those into Activity. All you need to do is just fit in the layout.


Then, you will see the rendering in this way eventually. This is easy.


Let me put down the logic now. You have 4 steps to go; 1) Run, and at the same time startup the service, 2) Display a menu when tapped, 3) Reset a timer with Reset, and 4) Finish it with Exit.

1) Control service

When Activity is run and onCreate is called as usual, startup the service. From the service by using LocalBroadcastReceiver you will receive the timer display update request.


2) Display a menu

Menu is displayed when it is tapped. You can use just normal a href=”http://developer.android.com/guide/topics/ui/menus.html#options-menu” title=”Menus | Android Developers”>Options Menu at this time. Its appearance is very different from the one in the Glass Menu, but making a good one now is kind of wasting time (you will see the notice next time!), so forget it and just use it.

3) Reset a timer

This shows the process when Reset is called in the Options Menu. Reset the service.

4) Finish it

This shows the process when Exit is called in the Options Menu. Stop the service and finish the application.

Once you get to here, the left is the service which processes the timer. One more step to go.

Making a timer service

Just write down as usual in the following way.


Do not forget a declaration at AndroidManifest.xml.

Add resources

res/rawに2つのOgg Vorbisファイルを追加します。

ring.ogg: clicking sound

tick.ogg: ticking sound

Complete a prototype!

Let’s build and execute it. Does it start the countdown as soon as it is run? Does it display a menu when tapped, go back to 25 minutes with Reset, and stop the countdown with EXIT?

Someone who has done development with Eclipse has noticed it already. In Android Studio you can see errors, etc. in advance with underline markers. Even if the errors are still there, you can try to build and run it.

Let’s port this to a Glass actual device.