Managing assets at Android NDK
Assets provide a way for Android apps to include various types of files, including text, image, audio, video, and so on. This recipe discusses how to load asset files from Android NDK.
Getting ready
We will modify the example we developed in the Mapping texture in OpenGL ES 1.x recipe in Chapter 4, Android NDK OpenGL ES API. Readers are suggested to read through the recipe or take a look at the code first.
How to do it…
The following steps describe how the sample application is developed:
Create an Android application named
NativeAssets
. Set the package name ascookbook.chapter5.nativeassets
. Please refer to the Loading native libraries and registering native methods recipe of Chapter 2, Java Native Interface, if you want more detailed instructions.Right-click on the
NativeAssets
project, select Android Tools | Add Native Support.Add three Java files, namely
MyActivity.java
,MySurfaceView.java
, andMyRenderer.java
under thecookbook.chapter5.nativeassets
package...