Adding GUI to a ported Android app
The previous two recipes demonstrate how to port a command-line executable to Android. Needless to say, the biggest disadvantage of such a method is that it cannot be executed on a non-rooted Android device. This recipe discusses how to address the issue by adding a GUI when porting an application to Android.
How to do it...
The following steps describe how to add a simple UI to the ported app:
Create an Android application named
PortingExecutableAUI
with native support. Set the package name ascookbook.chapter9.portingexecutableaui
. Refer to the Loading native libraries and registering native methods recipe of Chapter 2, Java Native Interface, if you want more detailed instructions.Follow steps 2 to 8 of the Porting a command line executable to Android with NDK build system recipe of this chapter.
Add a
mylog.h
file under thejni/fusch
folder. Add the following lines to thejni/fusch/fusch.c
file at the beginning of the main method, then remove the original...