Time for action – creating a basic native Activity
We are now going to see how to create a minimal native activity that runs an event loop.
Create a new hybrid Java/C++ project, as shown in Chapter 2, Starting a Native Android Project.
Name it
DroidBlaster
.Turn the project into a native project, as already seen in the previous chapter. Name the native module
droidblaster
.Remove the native source and header files that have been created by ADT.
Remove the reference to the Java
src
directory in Project Properties | Java Build Path | Source. Then, remove the directory itself on disk.Get rid of all layouts in the
res/layout
directory.Get rid of
jni/droidblaster.cpp
if it has been created.
In
AndroidManifest.xml
, useTheme.NoTitleBar.Fullscreen
as the application theme.Declare a
NativeActivity
that refers to the native module nameddroidblaster
(that is, the native library we will compile) using the meta-data propertyandroid.app.lib_name
:<?xml version="1.0" encoding="utf-8"?> <manifest xmlns...