Sunday, September 20, 2015

App a Day 5: Timer

Classes Used: Timer, TimerTask, Calendar, Handler.

I needed a really simple app for this day and this was much simpler than I thought it ever would be. This straightforward tutorial shows all the basics. The app simply starts a timer which runs a task. The timer runs in the background, but then sends a runnable back to the UI thread every second to update the timer display with the current count. In this one I didn't use a layout xml file because it was complicating things for when I wanted to swap out the buttons. I suppose better way would just be to have the button use one onClickListener a which would determine if I'm starting or stopping, but I didn't think of that then.

No comments:

Post a Comment