April 2015
Beginner to intermediate
494 pages
10h 26m
English
com.packtpub.store.Color encapsulating an integer representation of a color. This integer is parsed from String containing HTML code (for example, #FF0000) thanks to the android.graphics.Color class:package com.packtpub.store;
import android.text.TextUtils;
public class Color {
private int mColor;
public Color(String pColor) {
if (TextUtils.isEmpty(pColor)) {
throw new IllegalArgumentException();
}
mColor = android.graphics.Color.parseColor(pColor);
}
@Override
public String toString() {
return String.format("#%06X", mColor);
}
}StoreType.java, append the new Color data type to the enumeration:public enum StoreType {
Integer,
String,
Color
}Store ...