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:

  1. Create an Android application named PortingExecutableAUI with native support. Set the package name as cookbook.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.
  2. Follow steps 2 to 8 of the

Get Android Native Development Kit Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.