Implementing ViewHandler
As blocks will be moving along the fields in intervals with a constant time delay, we need a means of putting the thread that handles the movement of blocks to sleep and waking the thread to make a block motion after a period of time. A good way to take care of this requirement is to use a handler to process message delay requests and continue message handling after the delay has completed. Putting this in more direct terms, according to Android's documentation, the handler allows you to send and process Message objects associated with a thread's MessageQueue. Every handler instance is associated with a thread and the thread's message queue.
ViewHandler is a custom handler we will implement for TetrisView that caters ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access