O'Reilly logo

Android NDK Beginner's Guide by Sylvain Ratabouil

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – embedding GNU STL in DroidBlaster

  1. Create a jni/Application.mk file beside jni/Android.mk and write the following content. That's it! Your application is now STL-enabled, thanks to this single line:
    APP_STL = stlport_static

    Of course, enabling the STL is useless, if we do not actively use it in our code. Let's take advantage of this opportunity to switch from asset files to external files (on a sdcard or internal memory).

  2. Open the existing file, jni/Resource.hpp, and:
    • Include the fstream stl header to read files.
    • Replace the Asset management members with an ifstream object (that is, an input file stream). We are also going to need a buffer for the bufferize() method.
    • Remove the descript() method and the ResourceDescriptor class. Descriptors ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required