PacktLib: Android Native Development Kit Cookbook

Android Native Development Kit Cookbook

Credits

About the Author

About the Reviewers

www.PacktPub.com

Preface

Hello NDK

Introduction

Setting up an Android NDK development environment in Windows

Setting up an Android NDK development environment in Ubuntu Linux

Setting up an Android NDK development environment in Mac OS

Updating Android NDK

Writing a Hello NDK program

Java Native Interface

Introduction

Loading native libraries and registering native methods

Passing parameters and receiving returns in primitive types

Manipulating strings in JNI

Managing references in JNI

Manipulating classes in JNI

Manipulating objects in JNI

Manipulating arrays in JNI

Accessing Java static and instance fields in the native code

Calling static and instance methods from the native code

Caching jfieldID, jmethodID, and referencing data to improve performance

Checking errors and handling exceptions in JNI

Integrating assembly code in JNI

Build and Debug NDK Applications

Introduction

Building an Android NDK application at the command line

Building an Android NDK application in Eclipse

Building an Android NDK application for different ABIs

Building Android NDK applications for different CPU features

Debugging an Android NDK application with logging messages

Debugging an Android NDK application with CheckJNI

Debugging an Android NDK application with NDK GDB

Debugging an Android NDK application with CGDB

Debugging an Android NDK application in Eclipse

Android NDK OpenGL ES API

Introduction

Drawing 2D Graphics and applying transforms with the OpenGL ES 1.x API

Drawing 3D graphics and lighting up the scene with the OpenGL ES 1.x API

Mapping texture to 3D objects with the OpenGL ES 1.x API

Drawing 3D graphics with the OpenGL ES 2.0 API

Displaying graphics with EGL

Android Native Application API

Introduction

Creating a native activity with the native_activity.h interface

Creating a native activity with the Android native app glue

Managing native windows at Android NDK

Detecting and handling input events at Android NDK

Accessing sensors at Android NDK

Managing assets at Android NDK

Android NDK Multithreading

Introduction

Creating and terminating native threads at Android NDK

Synchronizing native threads with mutex at Android NDK

Synchronizing native threads with conditional variables at Android NDK

Synchronizing native threads with reader/writer locks at Android NDK

Synchronizing native threads with semaphore at Android NDK

Scheduling native threads at Android NDK

Managing data for native threads at Android NDK

Other Android NDK API

Introduction

Programming with the jnigraphics library in Android NDK

Programming with the dynamic linker library in Android NDK

Programming with the zlib compression library in Android NDK

Programming audio with the OpenSL ES audio library in Android NDK

Programming with the OpenMAX AL multimedia library in Android NDK

Porting and Using the Existing Libraries with Android NDK

Introduction

Porting a library as a shared library module with the Android NDK build system

Porting a library as a static library module with the Android NDK build system

Porting a library with its existing build system using the Android NDK toolchain

Using a library as a prebuilt library

Using a library in multiple projects with import-module

Porting a library that requires RTTI, exception, and STL support

Porting an Existing Application to Android with NDK

Introduction

Porting a command-line executable to Android with an NDK build system

Porting a command-line executable to Android with an NDK standalone compiler

Adding GUI to a ported Android app

Using background threads at porting

Index