Let’s take care of the Java side first:
Create a new hybrid Java/C++ project like shown in the previous chapter:
Name it
Store.
Its main package is
com.packtpub.
Its main activity is
StoreActivity.
Do not forget to create a
jni
directory at project’s root.
Let’s work on the Java side first, which is going to contain three source files:
Store.java
,StoreType.java
, andStoreActivity.java
.Create a new class
Store
which loads the eponym native library and defines the functionalities our key/value store provides.Store
is a front-end to our native code. To get started, it supports only integers and strings:public class Store { static { System.loadLibrary("store"); } public native int getInteger(String pKey); public native void setInteger(String pKey, int pInt); public native String getString(String pKey); public native void setString(String pKey, String pString); }
Create
StoreType.java
with an enumeration specifying...