Time for action – handling Java arrays in native Store

To help us handle operations on arrays, let's download a helper library, Google Guava (release 18.0 at the time of writing this book) available at http://code.google.com/p/guava-libraries/. Guava offers many useful methods to deal with primitives and arrays, and perform "pseudo-functional" programming.

Copy guava jar in the project libs directory. Open the Properties project and go to Java Build Path | Libraries. Reference Guava jar by clicking on the Add JARs... button and validate.

  1. Edit the StoreType.java enumeration and add three new values: IntegerArray, StringArray, and ColorArray:
    public enum StoreType {
        ...
        Color,
        IntegerArray,
        StringArray,
        ColorArray
    }
  2. Open Store.java and add new methods ...

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.