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 – decoding camera feed from native code

  1. Create a new hybrid Java/C++ project like shown in Chapter 2, Creating, Compiling, and Deploying Native Projects:
    • Name it LiveCamera.
    • Its main package is com.packtpub.
    • Its main activity is LiveCameraActivity.
    • Get rid of res/main.xml as we will not create a GUI this time.
    • Do not forget to create a jni directory at project's root.
  2. In the application manifest, set the activity style to fullscreen and its orientation to landscape. Landscape orientation avoids most camera orientation problems that can be met on Android devices. Also request acces permission to the Android camera:
    <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.packtpub" ...

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