Accessing window and time natively

Application events are essential to understand. But they are only a part of the puzzle and will not get your users much excited. An interesting feature of the Android NDK is the ability to access display window natively to draw graphics. But who talks about graphics talks also about timing. Indeed, Android devices have different capabilities. Animations should be adapted to their speed. To help us in this task, Android gives access to time primitives thanks to its good support of Posix APIs.

We are now going to exploit these features to get a graphic feedback in our application: a red square moving on the screen. This square is going to be animated according to time to get a reproducible result.


Project DroidBlaster_Part5-2 ...

Get Android NDK Beginner's Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.