Book Image

Android NDK: Beginner's Guide

By : Sylvain Ratabouil
Book Image

Android NDK: Beginner's Guide

By: Sylvain Ratabouil

Overview of this book

Table of Contents (18 chapters)
Android NDK Beginner's Guide Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – creating a basic native Activity


We are now going to see how to create a minimal native activity that runs an event loop.

  1. Create a new hybrid Java/C++ project, as shown in Chapter 2, Starting a Native Android Project.

    • Name it DroidBlaster.

    • Turn the project into a native project, as already seen in the previous chapter. Name the native module droidblaster.

    • Remove the native source and header files that have been created by ADT.

    • Remove the reference to the Java src directory in Project Properties | Java Build Path | Source. Then, remove the directory itself on disk.

    • Get rid of all layouts in the res/layout directory.

    • Get rid of jni/droidblaster.cpp if it has been created.

  2. In AndroidManifest.xml, use Theme.NoTitleBar.Fullscreen as the application theme.

    Declare a NativeActivity that refers to the native module named droidblaster (that is, the native library we will compile) using the meta-data property android.app.lib_name:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns...