Time for action – handling primitives in the native store
- In
StoreType.java
, add the newly managed integer type to the enumeration:public enum StoreType { Integer, String }
- Open
Store.java
and define the new integer functionalities our native store provides:public class Store { ... public native int getCount(); 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); }
- In the
StoreActivity
class, update theonGetValue()
method to retrieve integer entries from the store when they are selected in the GUI:public class StoreActivity extends Activity { ... public static class PlaceholderFragment extends Fragment ...
Get Android NDK Beginner's Guide - Second Edition 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.