E-book details

Android Native Development Kit Cookbook. Create Android apps using Native C/C++ with the expert guidance contained in this cookbook. From basic routines to advanced multimedia development, it helps you harness the full power of Android NDK

Android Native Development Kit Cookbook. Create Android apps using Native C/C++ with the expert guidance contained in this cookbook. From basic routines to advanced multimedia development, it helps you harness the full power of Android NDK

Liu Feipeng

Ebook
Building Android applications would usually mean that you spend all of your time working in Java. There are however times when this is not the most efficient or best method for the application being built. This is where Android NDK comes in. Android NDK allows the developer to write in Native C/C++, giving you the power to reuse code and libraries and also, in most cases, increase the speed and efficiency of your application.The Android Native Development Kit Cookbook will help you understand the development, building, and debugging of your native Android applications. We will discover and learn JNI programming and essential NDK APIs such as OpenGL ES, and the native application API. We will then explore the process of porting existing libraries and software to NDK. By the end of this book you will be able to build your own apps in NDK apps.Android Native Development Kit Cookbook begins with basic recipes that will help you in the building and debugging of native apps, and JNI programming. The recipes cover various topics of application development with Android NDK such as OpenGL programming and Multimedia programming. We will begin with a simple recipe, Hello NDK, before moving on to cover advanced topics with recipes on OpenGL ES that focus on 2D and 3D graphics, as well as recipes that discuss working with NDK and external APIs. If you are looking for ways to make your application available in Android and take measures to boost your application's performance, then this Cookbook is for you.
  • 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
        • Theres 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...
          • Initialize and destroy mutex
          • Using the mutex
        • There's more...
      • Synchronizing native threads with conditional variables at Android NDK
        • How to do it...
        • How it works...
          • Initialize and destroy conditional variables
          • Using the conditional variable:
        • There's more...
          • Conditional variable attributes functions
          • Timed conditional variable functions
      • Synchronizing native threads with reader/writer locks at Android NDK
        • Getting ready...
        • How to do it...
        • How it works...
          • Initialize and destroy a reader/writer lock
          • Using a reader/writer lock
        • There's more...
          • Timed read/write lock and trylock
          • Reader/writer lock attribute functions
      • Synchronizing native threads with semaphore at Android NDK
        • Getting ready...
        • How to do it...
        • How it works...
          • Initialize and destroy a semaphore
          • Using a semaphore
      • Scheduling native threads at Android NDK
        • Getting ready...
        • How to do it...
        • How it works...
          • Scheduling contention scope
          • Scheduling policy and thread priority
          • Scheduling using nice value/level
      • Managing data for native threads at Android NDK
        • Getting ready...
        • How to do it...
        • How it works...
          • Creation and deletion of thread-specific data key
          • Set and get thread-specific data
    • 7. Other Android NDK API
      • Introduction
      • Programming with the jnigraphics library in Android NDK
        • Getting ready
        • How to do it...
        • How it works...
        • There's more
      • Programming with the dynamic linker library in Android NDK
        • Getting ready...
        • How to do it...
        • How it works...
      • Programming with the zlib compression library in Android NDK
        • Getting ready...
        • How to do it...
        • How it works...
        • There's more...
      • Programming audio with the OpenSL ES audio library in Android NDK
        • Getting ready...
        • How to do it...
        • How it works...
          • Object creation
          • Changing states of objects
          • Use and build with OpenSL ES Audio library
          • OpenSL ES audio recording
          • OpenSL ES audio playback
        • There's more...
      • Programming with the OpenMAX AL multimedia library in Android NDK
        • Getting ready...
        • How to do it...
        • How it works...
          • Use and build with the OpenMAX AL multimedia library:
          • OpenMAX AL video playback
        • There's more....
    • 8. Porting and Using the Existing Libraries with Android NDK
      • Introduction
      • Porting a library as a shared library module with the Android NDK build system
        • Getting ready
        • How to do it...
        • How it works...
        • See also
      • Porting a library as a static library module with the Android NDK build system
        • Getting ready
        • How to do it...
        • How it works...
        • See also
      • Porting a library with its existing build system using the Android NDK toolchain
        • How to do it...
        • How it works...
        • There's more...
      • Using a library as a prebuilt library
        • How to do it...
        • How it works...
      • Using a library in multiple projects with import-module
        • How to do it...
        • How it works...
      • Porting a library that requires RTTI, exception, and STL support
        • How to do it...
        • How it works...
    • 9. Porting an Existing Application to Android with NDK
      • Introduction
      • Porting a command-line executable to Android with an NDK build system
        • Getting ready
        • How to do it...
        • How it works...
          • Understanding the Android.mk files
      • Porting a command-line executable to Android with an NDK standalone compiler
        • Getting ready
        • How to do it...
        • How it works...
          • Porting libpng
          • Porting libseamcarv
          • Porting fusch
      • Adding GUI to a ported Android app
        • How to do it...
        • How it works...
      • Using background threads at porting
        • Getting ready
        • How to do it...
        • How it works...
          • Sending messages from the native code
    • Index
  • Title: Android Native Development Kit Cookbook. Create Android apps using Native C/C++ with the expert guidance contained in this cookbook. From basic routines to advanced multimedia development, it helps you harness the full power of Android NDK
  • Author: Liu Feipeng
  • Original title: Android Native Development Kit Cookbook. Create Android apps using Native C/C++ with the expert guidance contained in this cookbook. From basic routines to advanced multimedia development, it helps you harness the full power of Android NDK.
  • ISBN: 9781849691512, 9781849691512
  • Date of issue: 2013-03-26
  • Format: Ebook
  • Item ID: e_3b74
  • Publisher: Packt Publishing