January 2014
Intermediate to advanced
736 pages
70h 43m
English
This app performs its animations manually by updating the game elements from a separate thread of execuion. To do this, we use a subclass of Thread with a run method that directs our custom CannonView to update the positions of the game’s elements, then draws them. The run method drives the frame-by-frame animations—this is known as the game loop.
Normally, all updates to an app’s user interface must be performed in the GUI thread of execution. In Android, it’s important to minimize the amount of work you do in the GUI thread to ensure that the GUI remains responsive and does not display ANR (Application Not Responding) dialogs. However, games often require complex logic ...
Read now
Unlock full access