O'Reilly logo

Android NDK Beginner's Guide 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 – saving a reference to an object in the Store

First, let’s append the Color data type to the Java client:

  1. In package com.packtpub, create a new class Color that contains an integer representation of a color. This integer is parsed from a String (HTML codes such as #FF0000) thanks to the Android android.graphics.Color class:
    public class Color {
        private int mColor;
    
        public Color(String pColor) {
            super();
            mColor = android.graphics.Color.parseColor(pColor);
        }
    
        @Override
        public String toString() {
            return String.format("#%06X", mColor);
        }
    }
  2. Change StoreType enumeration to include the new Color data type:
    public enum StoreType {
        Integer, String, Color
    }
  3. Open the Store.java file created in the previous part and add two new methods to retrieve ...

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