Code example for TypedArray

Methods: getString, hasValue

0
            } 
            return null; 
        } 
 
        protected String[] parseStringArray(TypedArray a, int index) {
            if (a.hasValue(index)) {
                return KeySpecParser.parseCsvString(a.getString(index), mTextsSet);
            } 
            return null; 
        } 
    } 
 
    class EmptyKeyStyle extends KeyStyle { 
        @Override 
        public String[] getStringArray(TypedArray a, int index) {
            return parseStringArray(a, index);
        } 
 
        @Override 
        public String getString(TypedArray a, int index) {
            return parseString(a, index);
        } 
 
        @Override 
        public int getInt(TypedArray a, int index, int defaultValue) {
            return a.getInt(index, defaultValue);
        } 
 
        @Override 
        public int getFlag(TypedArray a, int index) {
            return a.getInt(index, 0);
        } 
    } 
 
    private class DeclaredKeyStyle extends KeyStyle { 
        private final String mParentStyleName;
        private final HashMap<Integer, Object> mStyleAttributes = new HashMap<Integer, Object>();
 
        public DeclaredKeyStyle(String parentStyleName) {
            mParentStyleName = parentStyleName;
        } 
 
        @Override 
        public String[] getStringArray(TypedArray a, int index) {
            if (a.hasValue(index)) {
                return parseStringArray(a, index);
            } 
            if (mStyleAttributes.containsKey(index)) {
                return (String[])mStyleAttributes.get(index);
            }