This is part of my AudioViz project on GitHub. This service broadcasts an Intent (com.app.playing) when it starts to play. I did this because I found that there was a delay between when I started the service, and when the music was playing which caused NullPointerExceptions. Elsewhere in the code, I have a Broadcast receiver listening for this broadcast upon which the rest of initialization code is run.
A Postfix Calculator implemented using a Stack in Java: