Time for action – creating a Java UI
Let's create a new Java project with a JNI module.
- 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 andtargetSdkVersion
is 19.- Define the
android.permission.WRITE_EXTERNAL_STORAGE
permission in theAndroidManifest.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 layoutactivity_renderscript.xml
.
- Name it
- Define the
project.properties
file as follows. These lines activate theRenderScript
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
- 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...
- A