Time for action – handling strings in the native store
Let's handle String values in our store:
Open
StoreType.java
and specify the new String type our store handles in the enumeration:public enum StoreType { String } Open Store.java and define the new functionalities our native key/value store provides (for now, only strings): public class Store { ... public native int getCount(); public native String getString(String pKey); public native void setString(String pKey, String pString); }
In
StoreActivity.java
, retrieve string entries from the nativeStore
in theonGetValue()
method. Do it according to the typeStoreType
currently selected in the GUI (even if there is only one possible type for now):public class StoreActivity extends Activity { ... public static class PlaceholderFragment extends Fragment { ... private void onGetValue() { ... switch (type) { case String: mUIValueEdit.setText(mStore...