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 Java UI


Let's create a new Java project with a JNI module.

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

    • Name it RenderScript.

    • The main package is com.packtpub.renderscript.

    • minSdkVersion is 9 and targetSdkVersion is 19.

    • Define the android.permission.WRITE_EXTERNAL_STORAGE permission in the AndroidManifest.xml file.

    • Turn the project into a native project as already seen.

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

    • Name the main Activity RenderScriptActivity and its layout activity_renderscript.xml.

  2. Define the project.properties file as follows. These lines activate the RenderScript support library, which allows porting code to older devices until API 8:

    target=android-20
    renderscript.target=20
    renderscript.support.mode=true
    sdk.buildtools=20
    
  3. Modify res/activity_renderscript.xml to make it look as follows. We will need:

    • A SeekBar to define the blur radius

    • A Button to apply the blur effect

    • Two ImageView...