O'Reilly logo

Android NDK Beginner's Guide by Sylvain Ratabouil

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

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.

Note

Project DroidBlaster_Part5-2 ...

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