O'Reilly logo

Beginning Android Tablet Games Programming by Jeremy Kerfs

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Input Queues

Earlier, the chapter discussed how massive amounts of user input can freeze a game and cause it to stall. You can address this possibility with the very handy InputObject class. Basically, you’re trying to limit the strain that is put on your main thread when input events happen. Recall that Figure 3-2 showed how you hold input events before responding to them. This is exactly what you do here. Instead of waiting to lock up the entire thread, you do the majority of the work in the background.

This system was originally introduced to me by Robert Green, and it’s so efficient and simple that I have used it ever since. (You can read Robert’s blog about Android development and other musings at www.rbgrn.net/.) An ArrayBlockingQueue ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required