A state machine implementation for Android and Java