Code example for SparseArray

Methods: getput

0
     * @param typefaceValue values ​​for the "typeface" attribute 
     * @return Roboto {@link Typeface} 
     * @throws IllegalArgumentException if unknown `typeface` attribute value. 
     */ 
    private Typeface obtaintTypeface(Context context, int typefaceValue) throws IllegalArgumentException {
        Typeface typeface = mTypefaces.get(typefaceValue);
        if (typeface == null) {
            typeface = createTypeface(context, typefaceValue);
            mTypefaces.put(typefaceValue, typeface);
        } 
        return typeface;
    } 
 
    /** 
     * Create typeface from assets. 
     * 
     * @param context       The Context the widget is running in, through which it can 
     *                      access the current theme, resources, etc. 
     * @param typefaceValue values ​​for the "typeface" attribute 
     * @return Roboto {@link Typeface}