Introduction
The previous chapter covered various techniques of porting a native library to Android with NDK. This chapter discusses the porting of native applications.
We will first introduce how to build a native command-line application for Android with an Android NDK build system and the standalone compiler provided by NDK. We will then add a GUI for the ported application. Finally, we illustrate using a background thread to do the heavy processing and sending the progress update message from the native code to the Java UI thread for GUI updates.
We will use the open source Fugenschnitzer program throughout this chapter. It is a content-aware image resizing program based on the Seam Carving algorithm. The basic idea of this algorithm is to change the size of an image by searching for and manipulating the seams (a seam is a path of connected pixels from top to bottom, or left to right) from the original image. The algorithm is able to resize an image while trying to keep the important...