Ebook Android Native Development Kit Cookbook

Android Native Development Kit Cookbook
Android Native Development Kit Cookbook

Download

THÔNG TIN TÀI LIỆU

Nhà xuất bản Packt Publishing
Tác giả Feipeng Liu
Số trang 346
Ngày xuất bản 2013
File PDF

NỘI DUNG TÀI LIỆU
Chapter 1: Hello NDK 7
Introduction 7
Setting up an Android NDK development environment in Windows 8
Setting up an Android NDK development environment in Ubuntu Linux 16
Setting up an Android NDK development environment in Mac OS 19
Updating Android NDK 20
Writing a Hello NDK program 22

Chapter 2: Java Native Interface 27
Introduction 28
Loading native libraries and registering native methods 29
Passing parameters and receiving returns in primitive types 34
Manipulating strings in JNI 39
Managing references in JNI 43
Manipulating classes in JNI 50
Manipulating objects in JNI 53
Manipulating arrays in JNI 57
Accessing Java static and instance ields in the native code 62
Calling static and instance methods from the native code 67
Caching jieldID, jmethodID, and referencing data to improve performance 73
Checking errors and handling exceptions in JNI 76
Integrating assembly code in JNI 80

Chapter 3: Build and Debug NDK Applications 83
Introduction 83
Building an Android NDK application at the command line 84
Building an Android NDK application in Eclipse 94
Building an Android NDK application for different ABIs 97
Building Android NDK applications for different CPU features 102
Debugging an Android NDK application with logging messages 106
Debugging an Android NDK application with CheckJNI 110
Debugging an Android NDK application with NDK GDB 113
Debugging an Android NDK application with CGDB 116
Debugging an Android NDK application in Eclipse 119

Chapter 4: Android NDK OpenGL ES API 123
Introduction 123
Drawing 2D Graphics and applying transforms with the OpenGL ES 1.x API 127
Drawing 3D graphics and lighting up the scene with the OpenGL ES 1.x API 133
Mapping texture to 3D objects with the OpenGL ES 1.x API 140
Drawing 3D graphics with the OpenGL ES 2.0 API 145
Displaying graphics with EGL 152

Chapter 5: Android Native Application API 159
Introduction 159
Creating a native activity with the native_activity.h interface 161
Creating a native activity with the Android native app glue 166
Managing native windows at Android NDK 174
Detecting and handling input events at Android NDK 178
Accessing sensors at Android NDK 181
Managing assets at Android NDK 186

Chapter 6: Android NDK Multithreading 191
Introduction 191
Creating and terminating native threads at Android NDK 192
Synchronizing native threads with mutex at Android NDK 195
Synchronizing native threads with conditional variables at Android NDK 200
Synchronizing native threads with reader/writer locks at Android NDK 206
Synchronizing native threads with semaphore at Android NDK 212
Scheduling native threads at Android NDK 217
Managing data for native threads at Android NDK 228

Chapter 7: Other Android NDK API 233
Introduction 233
Programming with the jnigraphics library in Android NDK 234
Programming with the dynamic linker library in Android NDK 238
Programming with the zlib compression library in Android NDK 241
Programming audio with the OpenSL ES audio library in Android NDK 247
Programming with the OpenMAX AL multimedia library in Android NDK 259

Chapter 8: Porting and Using the Existing Libraries with Android NDK 265
Introduction 265
Porting a library as a shared library module with the Android NDK
build system 266
Porting a library as a static library module with the Android NDK
build system 271
Porting a library with its existing build system using the
Android NDK toolchain 275
Using a library as a prebuilt library 280
Using a library in multiple projects with import-module 282
Porting a library that requires RTTI, exception, and STL support 285

Chapter 9: Porting an Existing Application to Android with NDK 293
Introduction 293
Porting a command-line executable to Android with an NDK build system 294
Porting a command-line executable to Android with an NDK
standalone compiler 298
Adding GUI to a ported Android app 305
Using background threads at porting 310

Be the first to comment

Leave a Reply

Your email address will not be published.

*