O'Reilly logo

Android NDK Beginner's Guide - Second Edition by Sylvain Ratabouil

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required