Android Timer Screen Layout Demo (Android Stopwatch – Toothbrush Timer)
Android Stopwatch Example – Toothbrush Timer
In keeping with today’s Android Development posts I decided to program a fully functional version of the theoretical Android Stopwatch Timer App that I created a layout for in Android And The Screen Size Dilemma earlier today.
Additions and functions of interest are
I decided I needed a scenario to beef up the app and finally decided on a Toothbrush Timer. I had recently downloaded an Android stopwatch app to time how long I brushed my teeth. The recommended amount of time is 2 minutes. I was only brushing for about a quarter of that so I then used the stopwatch to make sure I brushed for 2 minutes every time.
Basic Look – Android Layout
I took the simple layout from the Screen Size demo layout I wrote today and added another vertical
TextView and another
Button. I then went ahead and programmed a toothbrush timer that alerts you to move quadrants every 30 seconds and at the 2 minute mark it tells you that you are done, all using
Toasts. I also read that for extra deep gum cleaning you could brush for an additional 15 – 30 seconds so there are
Toasts that inform you of that and a
TextView that is made visible after 2m 30s telling you that you should stop.
There’s also a pause/resume function that is a tad more complicated than you would initially expect and a reset button.
I wrote this app using API level “15” for Android version 4.0.3 as the build target but I modified the uses-sdk Min SDK version in the AndroidManifest.xml file to API level “10”. I ran it on an actual device running API level “10”, 2.3.3 – Gingerbread as well as API level “13”, 3.2 Honeycomb and ran it in the emulator using 4.0.3 ICS and on all 3 it worked perfectly in both portrait and landscape.
Source code will be posted in my portfolio page in the morning and explanations and descriptions will be posted to compliment that at around the same time.
[box title=”Update” color=”#1368f6″]Applogies for the absense of the promised source code for this Android Stopwatch Example. I have lost the source code for it. I will write an updated Jellybean 4.1 and backwards compatible example and link it here along with the layout files for you.[/box]
Notice: WP_Query was called with an argument that is deprecated since version 3.1.0!
caller_get_postsis deprecated. Use
ignore_sticky_postsinstead. in /var/www/html/wp-includes/functions.php on line 4080