Android Native Development Kit Cookbook
Table of Contents
Android Native Development Kit Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Hello NDK
Introduction
Setting up an Android NDK development environment in Windows
Getting ready
How to do itā¦
How it worksā¦
There's moreā¦
Setting up an Android NDK development environment in Ubuntu Linux
Getting ready
How to do itā¦
How it worksā¦
There's moreā¦
Setting up an Android NDK development environment in Mac OS
Getting ready
How to do itā¦
How it worksā¦
Updating Android NDK
Getting ready
How to do itā¦
How it worksā¦
There's moreā¦
Writing a Hello NDK program
Getting ready
How to do itā¦
How it worksā¦
There's moreā¦
2. Java Native Interface
Introduction
Loading native libraries and registering native methods
Getting ready
How to do itā¦
How it worksā¦
Passing parameters and receiving returns in primitive types
Getting ready
How to do itā¦
How it worksā¦
Manipulating strings in JNI
Getting ready
How to do it
How it worksā¦
There's moreā¦
Managing references in JNI
How to do itā¦
How it worksā¦
There's moreā¦
Manipulating classes in JNI
Getting ready
How to do itā¦
How it worksā¦
Manipulating objects in JNI
Getting ready
How to do itā¦
How it worksā¦
Manipulating arrays in JNI
Getting ready
How to do itā¦
How it worksā¦
Accessing Java static and instance fields in the native code
Getting ready
How to do itā¦
How it worksā¦
Calling static and instance methods from the native code
Getting ready
How to do itā¦
How it worksā¦
Caching jfieldID, jmethodID, and referencing data to improve performance
Getting ready
How to do itā¦
How it worksā¦
Checking errors and handling exceptions in JNI
Getting ready
How to do itā¦
How it worksā¦
There's more...
Integrating assembly code in JNI
Getting ready
How to do itā¦
How it worksā¦
3. Build and Debug NDK Applications
Introduction
Building an Android NDK application at the command line
Getting ready
How to do itā¦
How it worksā¦
There's more...
Taking screenshots from the command line
Building an Android NDK application in Eclipse
Getting ready
How to do itā¦
How it works...
Building an Android NDK application for different ABIs
Getting ready
How to do it...
How it worksā¦
Building Android NDK applications for different CPU features
Getting ready
How to do itā¦
How it worksā¦
There's moreā¦
More about CPU feature detection
Different approaches of building for different cpu features
Debugging an Android NDK application with logging messages
How to do itā¦
How it works...
Debugging an Android NDK application with CheckJNI
How to do it...
How it works...
Debugging an Android NDK application with NDK GDB
Getting ready
How to do it...
How it works...
Debugging an Android NDK application with CGDB
Getting ready
How to do it...
How it works...
Debugging an Android NDK application in Eclipse
Getting ready
How to do it...
How it works...
There's more...
4. Android NDK OpenGL ES API
Introduction
Drawing 2D Graphics and applying transforms with the OpenGL ES 1.x API
Getting ready
How to do it...
How it works...
OpenGL ES rendering display through GLSurfaceView
Drawing objects at OpenGL ES
Colors at OpenGL ES
OpenGL ES transformation
Drawing 3D graphics and lighting up the scene with the OpenGL ES 1.x API
Getting ready
How to do it...
How it works...
Mapping texture to 3D objects with the OpenGL ES 1.x API
Getting ready
How to do it...
How it works...
There's more...
Drawing 3D graphics with the OpenGL ES 2.0 API
Getting ready
How to do it...
How it works...
OpenGL Shading Language (GLSL)
How to use shader:
There's more...
Displaying graphics with EGL
Getting ready
How to do it...
How it works...
Window management
There's more...
5. Android Native Application API
Introduction
Creating a native activity with the native_activity.h interface
Getting ready
How to do itā¦
How it worksā¦
There's moreā¦
Creating a native activity with the Android native app glue
Getting ready
How to do itā¦
How it worksā¦
Managing native windows at Android NDK
Getting ready
How to do itā¦
How it worksā¦
Detecting and handling input events at Android NDK
Getting ready
How to do itā¦
How it worksā¦
Accessing sensors at Android NDK
Getting ready
How to do itā¦
How it worksā¦
Managing assets at Android NDK
Getting ready
How to do itā¦
How it worksā¦
There's moreā¦
6. Android NDK Multithreading
Introduction
Creating and terminating native threads at Android NDK
Getting readyā¦
How to do it...
How it works...
Build with pthreads
Thread creation
Thread termination
Synchronizing native threads with mutex at Android NDK
How to do it...
How it works...
...